state
stringlengths 0
159k
| srcUpToTactic
stringlengths 387
167k
| nextTactic
stringlengths 3
9k
| declUpToTactic
stringlengths 22
11.5k
| declId
stringlengths 38
95
| decl
stringlengths 16
1.89k
| file_tag
stringlengths 17
73
|
---|---|---|---|---|---|---|
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 β β€ | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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] | /-- 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
| Mathlib.RingTheory.Ideal.Operations.2138_0.5qK551sG47yBciY | /-- 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 | Mathlib_RingTheory_Ideal_Operations |
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 | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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 | /-- 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]
| Mathlib.RingTheory.Ideal.Operations.2138_0.5qK551sG47yBciY | /-- 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 | Mathlib_RingTheory_Ideal_Operations |
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 | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
| simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _ | /-- 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
| Mathlib.RingTheory.Ideal.Operations.2138_0.5qK551sG47yBciY | /-- 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 | Mathlib_RingTheory_Ideal_Operations |
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) | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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 => _β© | /-- 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
| Mathlib.RingTheory.Ideal.Operations.2148_0.5qK551sG47yBciY | /-- 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 | Mathlib_RingTheory_Ideal_Operations |
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 | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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)β»ΒΉ | /-- 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 => _β©
| Mathlib.RingTheory.Ideal.Operations.2148_0.5qK551sG47yBciY | /-- 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 | Mathlib_RingTheory_Ideal_Operations |
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 | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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 | /-- 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)β»ΒΉ
| Mathlib.RingTheory.Ideal.Operations.2148_0.5qK551sG47yBciY | /-- 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 | Mathlib_RingTheory_Ideal_Operations |
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 | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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] | /-- 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
| Mathlib.RingTheory.Ideal.Operations.2148_0.5qK551sG47yBciY | /-- 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 | Mathlib_RingTheory_Ideal_Operations |
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 | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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 _) | /-- 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]
| Mathlib.RingTheory.Ideal.Operations.2148_0.5qK551sG47yBciY | /-- 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 | Mathlib_RingTheory_Ideal_Operations |
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 | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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] | /-- 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 _)
| Mathlib.RingTheory.Ideal.Operations.2148_0.5qK551sG47yBciY | /-- 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 | Mathlib_RingTheory_Ideal_Operations |
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 | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
| simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self] | /-- 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]
| Mathlib.RingTheory.Ideal.Operations.2148_0.5qK551sG47yBciY | /-- 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 | Mathlib_RingTheory_Ideal_Operations |
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 | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
| rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap] | theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
| Mathlib.RingTheory.Ideal.Operations.2172_0.5qK551sG47yBciY | theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f | Mathlib_RingTheory_Ideal_Operations |
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) | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
| 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
| Mathlib.RingTheory.Ideal.Operations.2180_0.5qK551sG47yBciY | theorem map_isPrime_of_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') {I : Ideal R}
[IsPrime I] : IsPrime (map f I) | Mathlib_RingTheory_Ideal_Operations |
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) | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
| 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
| Mathlib.RingTheory.Ideal.Operations.2180_0.5qK551sG47yBciY | theorem map_isPrime_of_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') {I : Ideal R}
[IsPrime I] : IsPrime (map f I) | Mathlib_RingTheory_Ideal_Operations |
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) | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
| exact Ideal.IsPrime.comap (RingEquiv.symm (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)]
| Mathlib.RingTheory.Ideal.Operations.2180_0.5qK551sG47yBciY | theorem map_isPrime_of_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') {I : Ideal R}
[IsPrime I] : IsPrime (map f I) | Mathlib_RingTheory_Ideal_Operations |
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) | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
| 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
| Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
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 | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
refine' fun h => le_antisymm (le_sInf _) _
Β· | 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 _) _
Β· | Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
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 | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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 | 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
| Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
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 | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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 | 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
| Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
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 | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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] | 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
| Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
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 | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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) | 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]
| Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
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) | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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 | 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)
Β· | Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
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) | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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 | 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
| Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
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) | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
| refine' hx βΈ mem_map_of_mem f _ | 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
| Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
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
β’ x β sInf A | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
| have : β I β A, y β map f I := by simpa using 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
cases' hf y with x hx
refine' hx βΈ mem_map_of_mem f _
| Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
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
β’ β I β A, y β map f I | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by | simpa using 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
cases' hf y with x hx
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by | Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
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
this : β I β A, y β map f I
β’ x β sInf A | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
| rw [Submodule.mem_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 _) _
Β· 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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
| Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
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
this : β I β A, y β map f I
β’ β p β A, x β p | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
| intro 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
| Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
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
this : β I β A, y β map f I
J : Submodule R R
hJ : J β A
β’ x β J | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
| rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ© | 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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
| Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
case refine'_2.intro.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
x : R
J : Submodule R R
hJ : J β A
x' : R
hx' : x' β J
hy : f x' β sInf (map f '' A)
hx : f x = f x'
this : β I β A, f x' β map f I
β’ x β J | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
| have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self] | 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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
| Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
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
x : R
J : Submodule R R
hJ : J β A
x' : R
hx' : x' β J
hy : f x' β sInf (map f '' A)
hx : f x = f x'
this : β I β A, f x' β map f I
β’ x - x' β J | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
| apply h 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
| Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
case a
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
x : R
J : Submodule R R
hJ : J β A
x' : R
hx' : x' β J
hy : f x' β sInf (map f '' A)
hx : f x = f x'
this : β I β A, f x' β map f I
β’ x - x' β RingHom.ker f | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
| rw [RingHom.mem_ker, map_sub, hx, sub_self] | 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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
| Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
case refine'_2.intro.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
x : R
J : Submodule R R
hJ : J β A
x' : R
hx' : x' β J
hy : f x' β sInf (map f '' A)
hx : f x = f x'
thisβ : β I β A, f x' β map f I
this : x - x' β J
β’ x β J | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
| simpa only [sub_add_cancel] using J.add_mem this 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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
| Mathlib.RingTheory.Ideal.Operations.2194_0.5qK551sG47yBciY | 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) | Mathlib_RingTheory_Ideal_Operations |
R : Type u_1
S : Type u_2
F : Type u_3
instβΒΉ : Ring R
instβ : Ring S
rc : RingHomClass F R S
f : F
hf : Function.Surjective βf
I : Ideal R
H : IsPrime I
hk : RingHom.ker f β€ I
β’ IsPrime (map f I) | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
| refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β© | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
| Mathlib.RingTheory.Ideal.Operations.2215_0.5qK551sG47yBciY | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) | Mathlib_RingTheory_Ideal_Operations |
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
f : F
hf : Function.Surjective βf
I : Ideal R
H : IsPrime I
hk : RingHom.ker f β€ I
h : map f I = β€
β’ β€ β€ I | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· | replace h := congr_arg (comap f) h | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· | Mathlib.RingTheory.Ideal.Operations.2215_0.5qK551sG47yBciY | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) | Mathlib_RingTheory_Ideal_Operations |
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
f : F
hf : Function.Surjective βf
I : Ideal R
H : IsPrime I
hk : RingHom.ker f β€ I
h : comap f (map f I) = comap f β€
β’ β€ β€ I | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
| rw [comap_map_of_surjective _ hf, comap_top] at h | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
| Mathlib.RingTheory.Ideal.Operations.2215_0.5qK551sG47yBciY | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) | Mathlib_RingTheory_Ideal_Operations |
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
f : F
hf : Function.Surjective βf
I : Ideal R
H : IsPrime I
hk : RingHom.ker f β€ I
h : I β comap f β₯ = β€
β’ β€ β€ I | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
| exact h βΈ sup_le (le_of_eq rfl) hk | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
| Mathlib.RingTheory.Ideal.Operations.2215_0.5qK551sG47yBciY | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) | Mathlib_RingTheory_Ideal_Operations |
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
f : F
hf : Function.Surjective βf
I : Ideal R
H : IsPrime I
hk : RingHom.ker f β€ I
x y : S
β’ x * y β map f I β x β map f I β¨ y β map f I | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· | refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _ | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· | Mathlib.RingTheory.Ideal.Operations.2215_0.5qK551sG47yBciY | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) | Mathlib_RingTheory_Ideal_Operations |
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
f : F
hf : Function.Surjective βf
I : Ideal R
H : IsPrime I
hk : RingHom.ker f β€ I
x y : S
hxy : x * y β map f I
a : R
ha : f a = x
b : R
hb : f b = y
β’ x β map f I β¨ y β map f I | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
| rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
| Mathlib.RingTheory.Ideal.Operations.2215_0.5qK551sG47yBciY | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) | Mathlib_RingTheory_Ideal_Operations |
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
f : F
hf : Function.Surjective βf
I : Ideal R
H : IsPrime I
hk : RingHom.ker f β€ I
x y : S
a : R
ha : f a = x
b : R
hxy : β x β I, f x = f (a * b)
hb : f b = y
β’ x β map f I β¨ y β map f I | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
| rcases hxy with β¨c, hc, hc'β© | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
| Mathlib.RingTheory.Ideal.Operations.2215_0.5qK551sG47yBciY | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) | Mathlib_RingTheory_Ideal_Operations |
case refine'_2.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
f : F
hf : Function.Surjective βf
I : Ideal R
H : IsPrime I
hk : RingHom.ker f β€ I
x y : S
a : R
ha : f a = x
b : R
hb : f b = y
c : R
hc : c β I
hc' : f c = f (a * b)
β’ x β map f I β¨ y β map f I | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
| rw [β sub_eq_zero, β map_sub] at hc' | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
| Mathlib.RingTheory.Ideal.Operations.2215_0.5qK551sG47yBciY | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) | Mathlib_RingTheory_Ideal_Operations |
case refine'_2.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
f : F
hf : Function.Surjective βf
I : Ideal R
H : IsPrime I
hk : RingHom.ker f β€ I
x y : S
a : R
ha : f a = x
b : R
hb : f b = y
c : R
hc : c β I
hc' : f (c - a * b) = 0
β’ x β map f I β¨ y β map f I | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
| have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
| Mathlib.RingTheory.Ideal.Operations.2215_0.5qK551sG47yBciY | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) | Mathlib_RingTheory_Ideal_Operations |
R : Type u_1
S : Type u_2
F : Type u_3
instβΒΉ : Ring R
instβ : Ring S
rc : RingHomClass F R S
f : F
hf : Function.Surjective βf
I : Ideal R
H : IsPrime I
hk : RingHom.ker f β€ I
x y : S
a : R
ha : f a = x
b : R
hb : f b = y
c : R
hc : c β I
hc' : f (c - a * b) = 0
β’ a * b β I | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
| convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1 | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
| Mathlib.RingTheory.Ideal.Operations.2215_0.5qK551sG47yBciY | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) | Mathlib_RingTheory_Ideal_Operations |
case h.e'_4
R : Type u_1
S : Type u_2
F : Type u_3
instβΒΉ : Ring R
instβ : Ring S
rc : RingHomClass F R S
f : F
hf : Function.Surjective βf
I : Ideal R
H : IsPrime I
hk : RingHom.ker f β€ I
x y : S
a : R
ha : f a = x
b : R
hb : f b = y
c : R
hc : c β I
hc' : f (c - a * b) = 0
β’ a * b = c - (c - a * b) | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
| abel | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
| Mathlib.RingTheory.Ideal.Operations.2215_0.5qK551sG47yBciY | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) | Mathlib_RingTheory_Ideal_Operations |
case h.e'_4
R : Type u_1
S : Type u_2
F : Type u_3
instβΒΉ : Ring R
instβ : Ring S
rc : RingHomClass F R S
f : F
hf : Function.Surjective βf
I : Ideal R
H : IsPrime I
hk : RingHom.ker f β€ I
x y : S
a : R
ha : f a = x
b : R
hb : f b = y
c : R
hc : c β I
hc' : f (c - a * b) = 0
β’ a * b = c - (c - a * b) | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
| abel | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
| Mathlib.RingTheory.Ideal.Operations.2215_0.5qK551sG47yBciY | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) | Mathlib_RingTheory_Ideal_Operations |
case refine'_2.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
f : F
hf : Function.Surjective βf
I : Ideal R
H : IsPrime I
hk : RingHom.ker f β€ I
x y : S
a : R
ha : f a = x
b : R
hb : f b = y
c : R
hc : c β I
hc' : f (c - a * b) = 0
this : a * b β I
β’ x β map f I β¨ y β map f I | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
| exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
| Mathlib.RingTheory.Ideal.Operations.2215_0.5qK551sG47yBciY | theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) | Mathlib_RingTheory_Ideal_Operations |
R : Type u_1
S : Type u_2
F : Type u_3
instβΒΉ : Ring R
instβ : Ring S
rc : RingHomClass F R S
I : Ideal R
f : F
hf : Function.Injective βf
β’ map f I = β₯ β I = β₯ | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
| rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff] | theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
| Mathlib.RingTheory.Ideal.Operations.2232_0.5qK551sG47yBciY | theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ | Mathlib_RingTheory_Ideal_Operations |
R : Type u_1
S : Type u_2
F : Type u_3
instβΒΉ : CommRing R
instβ : CommRing S
I J : Ideal R
f : R β+* S
hf : Function.Surjective βf
β’ map f I = map f J β I β RingHom.ker f = J β RingHom.ker f | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
| rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot] | theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
| Mathlib.RingTheory.Ideal.Operations.2244_0.5qK551sG47yBciY | theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f | Mathlib_RingTheory_Ideal_Operations |
R : Type u_1
S : Type u_2
F : Type u_3
instβΒΉ : CommRing R
instβ : CommRing S
f : R β+* S
hf : Function.Surjective βf
I : Ideal R
h : RingHom.ker f β€ I
β’ map f (radical I) = radical (map f I) | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
| rw [radical_eq_sInf, radical_eq_sInf] | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
| Mathlib.RingTheory.Ideal.Operations.2250_0.5qK551sG47yBciY | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical | Mathlib_RingTheory_Ideal_Operations |
R : Type u_1
S : Type u_2
F : Type u_3
instβΒΉ : CommRing R
instβ : CommRing S
f : R β+* S
hf : Function.Surjective βf
I : Ideal R
h : RingHom.ker f β€ I
β’ map f (sInf {J | I β€ J β§ IsPrime J}) = sInf {J | map f I β€ J β§ IsPrime J} | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
| have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
| Mathlib.RingTheory.Ideal.Operations.2250_0.5qK551sG47yBciY | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical | Mathlib_RingTheory_Ideal_Operations |
R : Type u_1
S : Type u_2
F : Type u_3
instβΒΉ : CommRing R
instβ : CommRing S
f : R β+* S
hf : Function.Surjective βf
I : Ideal R
h : RingHom.ker f β€ I
this : β J β {J | I β€ J β§ IsPrime J}, RingHom.ker f β€ J
β’ map f (sInf {J | I β€ J β§ IsPrime J}) = sInf {J | map f I β€ J β§ IsPrime J} | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
| convert map_sInf hf this | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
| Mathlib.RingTheory.Ideal.Operations.2250_0.5qK551sG47yBciY | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical | Mathlib_RingTheory_Ideal_Operations |
case h.e'_3.h.e'_3
R : Type u_1
S : Type u_2
F : Type u_3
instβΒΉ : CommRing R
instβ : CommRing S
f : R β+* S
hf : Function.Surjective βf
I : Ideal R
h : RingHom.ker f β€ I
this : β J β {J | I β€ J β§ IsPrime J}, RingHom.ker f β€ J
β’ {J | map f I β€ J β§ IsPrime J} = map f '' {J | I β€ J β§ IsPrime J} | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
| refine' funext fun j => propext β¨_, _β© | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
| Mathlib.RingTheory.Ideal.Operations.2250_0.5qK551sG47yBciY | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical | Mathlib_RingTheory_Ideal_Operations |
case h.e'_3.h.e'_3.refine'_1
R : Type u_1
S : Type u_2
F : Type u_3
instβΒΉ : CommRing R
instβ : CommRing S
f : R β+* S
hf : Function.Surjective βf
I : Ideal R
h : RingHom.ker f β€ I
this : β J β {J | I β€ J β§ IsPrime J}, RingHom.ker f β€ J
j : Ideal S
β’ setOf (fun J => map f I β€ J β§ IsPrime J) j β (map f '' {J | I β€ J β§ IsPrime J}) j | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· | rintro β¨hj, hj'β© | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· | Mathlib.RingTheory.Ideal.Operations.2250_0.5qK551sG47yBciY | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical | Mathlib_RingTheory_Ideal_Operations |
case h.e'_3.h.e'_3.refine'_1.intro
R : Type u_1
S : Type u_2
F : Type u_3
instβΒΉ : CommRing R
instβ : CommRing S
f : R β+* S
hf : Function.Surjective βf
I : Ideal R
h : RingHom.ker f β€ I
this : β J β {J | I β€ J β§ IsPrime J}, RingHom.ker f β€ J
j : Ideal S
hj : map f I β€ j
hj' : IsPrime j
β’ (map f '' {J | I β€ J β§ IsPrime J}) j | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
| haveI : j.IsPrime := hj' | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
| Mathlib.RingTheory.Ideal.Operations.2250_0.5qK551sG47yBciY | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical | Mathlib_RingTheory_Ideal_Operations |
case h.e'_3.h.e'_3.refine'_1.intro
R : Type u_1
S : Type u_2
F : Type u_3
instβΒΉ : CommRing R
instβ : CommRing S
f : R β+* S
hf : Function.Surjective βf
I : Ideal R
h : RingHom.ker f β€ I
thisβ : β J β {J | I β€ J β§ IsPrime J}, RingHom.ker f β€ J
j : Ideal S
hj : map f I β€ j
hj' this : IsPrime j
β’ (map f '' {J | I β€ J β§ IsPrime J}) j | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
| exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β© | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
| Mathlib.RingTheory.Ideal.Operations.2250_0.5qK551sG47yBciY | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical | Mathlib_RingTheory_Ideal_Operations |
case h.e'_3.h.e'_3.refine'_2
R : Type u_1
S : Type u_2
F : Type u_3
instβΒΉ : CommRing R
instβ : CommRing S
f : R β+* S
hf : Function.Surjective βf
I : Ideal R
h : RingHom.ker f β€ I
this : β J β {J | I β€ J β§ IsPrime J}, RingHom.ker f β€ J
j : Ideal S
β’ (map f '' {J | I β€ J β§ IsPrime J}) j β setOf (fun J => map f I β€ J β§ IsPrime J) j | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· | rintro β¨J, β¨hJ, hJ'β©β© | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· | Mathlib.RingTheory.Ideal.Operations.2250_0.5qK551sG47yBciY | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical | Mathlib_RingTheory_Ideal_Operations |
case h.e'_3.h.e'_3.refine'_2.intro.intro
R : Type u_1
S : Type u_2
F : Type u_3
instβΒΉ : CommRing R
instβ : CommRing S
f : R β+* S
hf : Function.Surjective βf
I : Ideal R
h : RingHom.ker f β€ I
this : β J β {J | I β€ J β§ IsPrime J}, RingHom.ker f β€ J
j : Ideal S
J : Ideal R
hJ : J β {J | I β€ J β§ IsPrime J}
hJ' : map f J = j
β’ setOf (fun J => map f I β€ J β§ IsPrime J) j | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
| haveI : J.IsPrime := hJ.right | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
| Mathlib.RingTheory.Ideal.Operations.2250_0.5qK551sG47yBciY | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical | Mathlib_RingTheory_Ideal_Operations |
case h.e'_3.h.e'_3.refine'_2.intro.intro
R : Type u_1
S : Type u_2
F : Type u_3
instβΒΉ : CommRing R
instβ : CommRing S
f : R β+* S
hf : Function.Surjective βf
I : Ideal R
h : RingHom.ker f β€ I
thisβ : β J β {J | I β€ J β§ IsPrime J}, RingHom.ker f β€ J
j : Ideal S
J : Ideal R
hJ : J β {J | I β€ J β§ IsPrime J}
hJ' : map f J = j
this : IsPrime J
β’ setOf (fun J => map f I β€ J β§ IsPrime J) j | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
| refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β© | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
| Mathlib.RingTheory.Ideal.Operations.2250_0.5qK551sG47yBciY | theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical | Mathlib_RingTheory_Ideal_Operations |
R : Type u
M : Type v
instβΒ² : CommSemiring R
instβΒΉ : AddCommMonoid M
instβ : Module R M
β’ β (b : Submodule R M), 1 β’ b = b | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β©
#align ideal.map_radical_of_surjective Ideal.map_radical_of_surjective
end CommRing
end Ideal
namespace Submodule
variable {R : Type u} {M : Type v}
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
-- TODO: show `[Algebra R A] : Algebra (Ideal R) A` too
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by | simp | instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by | Mathlib.RingTheory.Ideal.Operations.2276_0.5qK551sG47yBciY | instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add | Mathlib_RingTheory_Ideal_Operations |
A : Type u_1
B : Type u_2
C : Type u_3
instβΒ² : Ring A
instβΒΉ : Ring B
instβ : Ring C
f : A β+* B
f_inv : B β A
hf : Function.RightInverse f_inv βf
g : A β+* C
hg : ker f β€ ker g
srcβ : B β+ C :=
(AddMonoidHom.liftOfRightInverse (toAddMonoidHom f) f_inv hf) { val := toAddMonoidHom g, property := hg }
β’ (fun b => g (f_inv b)) 1 = 1 | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β©
#align ideal.map_radical_of_surjective Ideal.map_radical_of_surjective
end CommRing
end Ideal
namespace Submodule
variable {R : Type u} {M : Type v}
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
-- TODO: show `[Algebra R A] : Algebra (Ideal R) A` too
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by simp
zero_smul := bot_smul
smul_zero := smul_bot
#align submodule.module_submodule Submodule.moduleSubmodule
end Submodule
namespace RingHom
variable {A B C : Type*} [Ring A] [Ring B] [Ring C]
variable (f : A β+* B) (f_inv : B β A)
/-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
| rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g] | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
| Mathlib.RingTheory.Ideal.Operations.2293_0.5qK551sG47yBciY | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C | Mathlib_RingTheory_Ideal_Operations |
A : Type u_1
B : Type u_2
C : Type u_3
instβΒ² : Ring A
instβΒΉ : Ring B
instβ : Ring C
f : A β+* B
f_inv : B β A
hf : Function.RightInverse f_inv βf
g : A β+* C
hg : ker f β€ ker g
srcβ : B β+ C :=
(AddMonoidHom.liftOfRightInverse (toAddMonoidHom f) f_inv hf) { val := toAddMonoidHom g, property := hg }
β’ f_inv 1 - 1 β ker g | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β©
#align ideal.map_radical_of_surjective Ideal.map_radical_of_surjective
end CommRing
end Ideal
namespace Submodule
variable {R : Type u} {M : Type v}
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
-- TODO: show `[Algebra R A] : Algebra (Ideal R) A` too
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by simp
zero_smul := bot_smul
smul_zero := smul_bot
#align submodule.module_submodule Submodule.moduleSubmodule
end Submodule
namespace RingHom
variable {A B C : Type*} [Ring A] [Ring B] [Ring C]
variable (f : A β+* B) (f_inv : B β A)
/-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
| apply hg | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
| Mathlib.RingTheory.Ideal.Operations.2293_0.5qK551sG47yBciY | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C | Mathlib_RingTheory_Ideal_Operations |
case a
A : Type u_1
B : Type u_2
C : Type u_3
instβΒ² : Ring A
instβΒΉ : Ring B
instβ : Ring C
f : A β+* B
f_inv : B β A
hf : Function.RightInverse f_inv βf
g : A β+* C
hg : ker f β€ ker g
srcβ : B β+ C :=
(AddMonoidHom.liftOfRightInverse (toAddMonoidHom f) f_inv hf) { val := toAddMonoidHom g, property := hg }
β’ f_inv 1 - 1 β ker f | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β©
#align ideal.map_radical_of_surjective Ideal.map_radical_of_surjective
end CommRing
end Ideal
namespace Submodule
variable {R : Type u} {M : Type v}
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
-- TODO: show `[Algebra R A] : Algebra (Ideal R) A` too
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by simp
zero_smul := bot_smul
smul_zero := smul_bot
#align submodule.module_submodule Submodule.moduleSubmodule
end Submodule
namespace RingHom
variable {A B C : Type*} [Ring A] [Ring B] [Ring C]
variable (f : A β+* B) (f_inv : B β A)
/-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
| rw [mem_ker f, map_sub f, sub_eq_zero, map_one f] | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
| Mathlib.RingTheory.Ideal.Operations.2293_0.5qK551sG47yBciY | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C | Mathlib_RingTheory_Ideal_Operations |
case a
A : Type u_1
B : Type u_2
C : Type u_3
instβΒ² : Ring A
instβΒΉ : Ring B
instβ : Ring C
f : A β+* B
f_inv : B β A
hf : Function.RightInverse f_inv βf
g : A β+* C
hg : ker f β€ ker g
srcβ : B β+ C :=
(AddMonoidHom.liftOfRightInverse (toAddMonoidHom f) f_inv hf) { val := toAddMonoidHom g, property := hg }
β’ f (f_inv 1) = 1 | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β©
#align ideal.map_radical_of_surjective Ideal.map_radical_of_surjective
end CommRing
end Ideal
namespace Submodule
variable {R : Type u} {M : Type v}
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
-- TODO: show `[Algebra R A] : Algebra (Ideal R) A` too
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by simp
zero_smul := bot_smul
smul_zero := smul_bot
#align submodule.module_submodule Submodule.moduleSubmodule
end Submodule
namespace RingHom
variable {A B C : Type*} [Ring A] [Ring B] [Ring C]
variable (f : A β+* B) (f_inv : B β A)
/-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
| exact hf 1 | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
| Mathlib.RingTheory.Ideal.Operations.2293_0.5qK551sG47yBciY | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C | Mathlib_RingTheory_Ideal_Operations |
A : Type u_1
B : Type u_2
C : Type u_3
instβΒ² : Ring A
instβΒΉ : Ring B
instβ : Ring C
f : A β+* B
f_inv : B β A
hf : Function.RightInverse f_inv βf
g : A β+* C
hg : ker f β€ ker g
srcβ : B β+ C :=
(AddMonoidHom.liftOfRightInverse (toAddMonoidHom f) f_inv hf) { val := toAddMonoidHom g, property := hg }
β’ β (x y : B),
OneHom.toFun { toFun := fun b => g (f_inv b), map_one' := (_ : (fun b => g (f_inv b)) 1 = 1) } (x * y) =
OneHom.toFun { toFun := fun b => g (f_inv b), map_one' := (_ : (fun b => g (f_inv b)) 1 = 1) } x *
OneHom.toFun { toFun := fun b => g (f_inv b), map_one' := (_ : (fun b => g (f_inv b)) 1 = 1) } y | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β©
#align ideal.map_radical_of_surjective Ideal.map_radical_of_surjective
end CommRing
end Ideal
namespace Submodule
variable {R : Type u} {M : Type v}
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
-- TODO: show `[Algebra R A] : Algebra (Ideal R) A` too
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by simp
zero_smul := bot_smul
smul_zero := smul_bot
#align submodule.module_submodule Submodule.moduleSubmodule
end Submodule
namespace RingHom
variable {A B C : Type*} [Ring A] [Ring B] [Ring C]
variable (f : A β+* B) (f_inv : B β A)
/-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
exact hf 1
map_mul' := by
| intro x y | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
exact hf 1
map_mul' := by
| Mathlib.RingTheory.Ideal.Operations.2293_0.5qK551sG47yBciY | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C | Mathlib_RingTheory_Ideal_Operations |
A : Type u_1
B : Type u_2
C : Type u_3
instβΒ² : Ring A
instβΒΉ : Ring B
instβ : Ring C
f : A β+* B
f_inv : B β A
hf : Function.RightInverse f_inv βf
g : A β+* C
hg : ker f β€ ker g
srcβ : B β+ C :=
(AddMonoidHom.liftOfRightInverse (toAddMonoidHom f) f_inv hf) { val := toAddMonoidHom g, property := hg }
x y : B
β’ OneHom.toFun { toFun := fun b => g (f_inv b), map_one' := (_ : (fun b => g (f_inv b)) 1 = 1) } (x * y) =
OneHom.toFun { toFun := fun b => g (f_inv b), map_one' := (_ : (fun b => g (f_inv b)) 1 = 1) } x *
OneHom.toFun { toFun := fun b => g (f_inv b), map_one' := (_ : (fun b => g (f_inv b)) 1 = 1) } y | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β©
#align ideal.map_radical_of_surjective Ideal.map_radical_of_surjective
end CommRing
end Ideal
namespace Submodule
variable {R : Type u} {M : Type v}
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
-- TODO: show `[Algebra R A] : Algebra (Ideal R) A` too
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by simp
zero_smul := bot_smul
smul_zero := smul_bot
#align submodule.module_submodule Submodule.moduleSubmodule
end Submodule
namespace RingHom
variable {A B C : Type*} [Ring A] [Ring B] [Ring C]
variable (f : A β+* B) (f_inv : B β A)
/-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
exact hf 1
map_mul' := by
intro x y
| rw [β map_mul g, β sub_eq_zero, β map_sub g, β mem_ker g] | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
exact hf 1
map_mul' := by
intro x y
| Mathlib.RingTheory.Ideal.Operations.2293_0.5qK551sG47yBciY | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C | Mathlib_RingTheory_Ideal_Operations |
A : Type u_1
B : Type u_2
C : Type u_3
instβΒ² : Ring A
instβΒΉ : Ring B
instβ : Ring C
f : A β+* B
f_inv : B β A
hf : Function.RightInverse f_inv βf
g : A β+* C
hg : ker f β€ ker g
srcβ : B β+ C :=
(AddMonoidHom.liftOfRightInverse (toAddMonoidHom f) f_inv hf) { val := toAddMonoidHom g, property := hg }
x y : B
β’ f_inv (x * y) - f_inv x * f_inv y β ker g | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β©
#align ideal.map_radical_of_surjective Ideal.map_radical_of_surjective
end CommRing
end Ideal
namespace Submodule
variable {R : Type u} {M : Type v}
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
-- TODO: show `[Algebra R A] : Algebra (Ideal R) A` too
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by simp
zero_smul := bot_smul
smul_zero := smul_bot
#align submodule.module_submodule Submodule.moduleSubmodule
end Submodule
namespace RingHom
variable {A B C : Type*} [Ring A] [Ring B] [Ring C]
variable (f : A β+* B) (f_inv : B β A)
/-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
exact hf 1
map_mul' := by
intro x y
rw [β map_mul g, β sub_eq_zero, β map_sub g, β mem_ker g]
| apply hg | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
exact hf 1
map_mul' := by
intro x y
rw [β map_mul g, β sub_eq_zero, β map_sub g, β mem_ker g]
| Mathlib.RingTheory.Ideal.Operations.2293_0.5qK551sG47yBciY | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C | Mathlib_RingTheory_Ideal_Operations |
case a
A : Type u_1
B : Type u_2
C : Type u_3
instβΒ² : Ring A
instβΒΉ : Ring B
instβ : Ring C
f : A β+* B
f_inv : B β A
hf : Function.RightInverse f_inv βf
g : A β+* C
hg : ker f β€ ker g
srcβ : B β+ C :=
(AddMonoidHom.liftOfRightInverse (toAddMonoidHom f) f_inv hf) { val := toAddMonoidHom g, property := hg }
x y : B
β’ f_inv (x * y) - f_inv x * f_inv y β ker f | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β©
#align ideal.map_radical_of_surjective Ideal.map_radical_of_surjective
end CommRing
end Ideal
namespace Submodule
variable {R : Type u} {M : Type v}
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
-- TODO: show `[Algebra R A] : Algebra (Ideal R) A` too
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by simp
zero_smul := bot_smul
smul_zero := smul_bot
#align submodule.module_submodule Submodule.moduleSubmodule
end Submodule
namespace RingHom
variable {A B C : Type*} [Ring A] [Ring B] [Ring C]
variable (f : A β+* B) (f_inv : B β A)
/-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
exact hf 1
map_mul' := by
intro x y
rw [β map_mul g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
| rw [mem_ker f, map_sub f, sub_eq_zero, map_mul f] | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
exact hf 1
map_mul' := by
intro x y
rw [β map_mul g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
| Mathlib.RingTheory.Ideal.Operations.2293_0.5qK551sG47yBciY | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C | Mathlib_RingTheory_Ideal_Operations |
case a
A : Type u_1
B : Type u_2
C : Type u_3
instβΒ² : Ring A
instβΒΉ : Ring B
instβ : Ring C
f : A β+* B
f_inv : B β A
hf : Function.RightInverse f_inv βf
g : A β+* C
hg : ker f β€ ker g
srcβ : B β+ C :=
(AddMonoidHom.liftOfRightInverse (toAddMonoidHom f) f_inv hf) { val := toAddMonoidHom g, property := hg }
x y : B
β’ f (f_inv (x * y)) = f (f_inv x) * f (f_inv y) | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β©
#align ideal.map_radical_of_surjective Ideal.map_radical_of_surjective
end CommRing
end Ideal
namespace Submodule
variable {R : Type u} {M : Type v}
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
-- TODO: show `[Algebra R A] : Algebra (Ideal R) A` too
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by simp
zero_smul := bot_smul
smul_zero := smul_bot
#align submodule.module_submodule Submodule.moduleSubmodule
end Submodule
namespace RingHom
variable {A B C : Type*} [Ring A] [Ring B] [Ring C]
variable (f : A β+* B) (f_inv : B β A)
/-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
exact hf 1
map_mul' := by
intro x y
rw [β map_mul g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_mul f]
| simp only [hf _] | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
exact hf 1
map_mul' := by
intro x y
rw [β map_mul g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_mul f]
| Mathlib.RingTheory.Ideal.Operations.2293_0.5qK551sG47yBciY | /-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C | Mathlib_RingTheory_Ideal_Operations |
A : Type u_1
B : Type u_2
C : Type u_3
instβΒ² : Ring A
instβΒΉ : Ring B
instβ : Ring C
f : A β+* B
f_inv : B β A
hf : Function.RightInverse f_inv βf
Ο : B β+* C
x : A
hx : x β ker f
β’ (comp Ο f) x = 0 | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β©
#align ideal.map_radical_of_surjective Ideal.map_radical_of_surjective
end CommRing
end Ideal
namespace Submodule
variable {R : Type u} {M : Type v}
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
-- TODO: show `[Algebra R A] : Algebra (Ideal R) A` too
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by simp
zero_smul := bot_smul
smul_zero := smul_bot
#align submodule.module_submodule Submodule.moduleSubmodule
end Submodule
namespace RingHom
variable {A B C : Type*} [Ring A] [Ring B] [Ring C]
variable (f : A β+* B) (f_inv : B β A)
/-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
exact hf 1
map_mul' := by
intro x y
rw [β map_mul g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_mul f]
simp only [hf _] }
#align ring_hom.lift_of_right_inverse_aux RingHom.liftOfRightInverseAux
@[simp]
theorem liftOfRightInverseAux_comp_apply (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) (a : A) :
(f.liftOfRightInverseAux f_inv hf g hg) (f a) = g a :=
f.toAddMonoidHom.liftOfRightInverse_comp_apply f_inv hf β¨g.toAddMonoidHom, hgβ© a
#align ring_hom.lift_of_right_inverse_aux_comp_apply RingHom.liftOfRightInverseAux_comp_apply
/-- `liftOfRightInverse f hf g hg` is the unique ring homomorphism `Ο`
* such that `Ο.comp f = g` (`RingHom.liftOfRightInverse_comp`),
* where `f : A β+* B` has a right_inverse `f_inv` (`hf`),
* and `g : B β+* C` satisfies `hg : f.ker β€ g.ker`.
See `RingHom.eq_liftOfRightInverse` for the uniqueness lemma.
```
A .
| \
f | \ g
| \
v \β
B ----> C
β!Ο
```
-/
def liftOfRightInverse (hf : Function.RightInverse f_inv f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) where
toFun g := f.liftOfRightInverseAux f_inv hf g.1 g.2
invFun Ο := β¨Ο.comp f, fun x hx => (mem_ker _).mpr <| by | simp [(mem_ker _).mp hx] | /-- `liftOfRightInverse f hf g hg` is the unique ring homomorphism `Ο`
* such that `Ο.comp f = g` (`RingHom.liftOfRightInverse_comp`),
* where `f : A β+* B` has a right_inverse `f_inv` (`hf`),
* and `g : B β+* C` satisfies `hg : f.ker β€ g.ker`.
See `RingHom.eq_liftOfRightInverse` for the uniqueness lemma.
```
A .
| \
f | \ g
| \
v \β
B ----> C
β!Ο
```
-/
def liftOfRightInverse (hf : Function.RightInverse f_inv f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) where
toFun g := f.liftOfRightInverseAux f_inv hf g.1 g.2
invFun Ο := β¨Ο.comp f, fun x hx => (mem_ker _).mpr <| by | Mathlib.RingTheory.Ideal.Operations.2319_0.5qK551sG47yBciY | /-- `liftOfRightInverse f hf g hg` is the unique ring homomorphism `Ο`
* such that `Ο.comp f = g` (`RingHom.liftOfRightInverse_comp`),
* where `f : A β+* B` has a right_inverse `f_inv` (`hf`),
* and `g : B β+* C` satisfies `hg : f.ker β€ g.ker`.
See `RingHom.eq_liftOfRightInverse` for the uniqueness lemma.
```
A .
| \
f | \ g
| \
v \β
B ----> C
β!Ο
```
-/
def liftOfRightInverse (hf : Function.RightInverse f_inv f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) where
toFun g | Mathlib_RingTheory_Ideal_Operations |
A : Type u_1
B : Type u_2
C : Type u_3
instβΒ² : Ring A
instβΒΉ : Ring B
instβ : Ring C
f : A β+* B
f_inv : B β A
hf : Function.RightInverse f_inv βf
g : { g // ker f β€ ker g }
β’ (fun Ο => { val := comp Ο f, property := (_ : β x β ker f, x β ker (comp Ο f)) })
((fun g => liftOfRightInverseAux f f_inv hf βg (_ : ker f β€ ker βg)) g) =
g | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β©
#align ideal.map_radical_of_surjective Ideal.map_radical_of_surjective
end CommRing
end Ideal
namespace Submodule
variable {R : Type u} {M : Type v}
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
-- TODO: show `[Algebra R A] : Algebra (Ideal R) A` too
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by simp
zero_smul := bot_smul
smul_zero := smul_bot
#align submodule.module_submodule Submodule.moduleSubmodule
end Submodule
namespace RingHom
variable {A B C : Type*} [Ring A] [Ring B] [Ring C]
variable (f : A β+* B) (f_inv : B β A)
/-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
exact hf 1
map_mul' := by
intro x y
rw [β map_mul g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_mul f]
simp only [hf _] }
#align ring_hom.lift_of_right_inverse_aux RingHom.liftOfRightInverseAux
@[simp]
theorem liftOfRightInverseAux_comp_apply (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) (a : A) :
(f.liftOfRightInverseAux f_inv hf g hg) (f a) = g a :=
f.toAddMonoidHom.liftOfRightInverse_comp_apply f_inv hf β¨g.toAddMonoidHom, hgβ© a
#align ring_hom.lift_of_right_inverse_aux_comp_apply RingHom.liftOfRightInverseAux_comp_apply
/-- `liftOfRightInverse f hf g hg` is the unique ring homomorphism `Ο`
* such that `Ο.comp f = g` (`RingHom.liftOfRightInverse_comp`),
* where `f : A β+* B` has a right_inverse `f_inv` (`hf`),
* and `g : B β+* C` satisfies `hg : f.ker β€ g.ker`.
See `RingHom.eq_liftOfRightInverse` for the uniqueness lemma.
```
A .
| \
f | \ g
| \
v \β
B ----> C
β!Ο
```
-/
def liftOfRightInverse (hf : Function.RightInverse f_inv f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) where
toFun g := f.liftOfRightInverseAux f_inv hf g.1 g.2
invFun Ο := β¨Ο.comp f, fun x hx => (mem_ker _).mpr <| by simp [(mem_ker _).mp hx]β©
left_inv g := by
| ext | /-- `liftOfRightInverse f hf g hg` is the unique ring homomorphism `Ο`
* such that `Ο.comp f = g` (`RingHom.liftOfRightInverse_comp`),
* where `f : A β+* B` has a right_inverse `f_inv` (`hf`),
* and `g : B β+* C` satisfies `hg : f.ker β€ g.ker`.
See `RingHom.eq_liftOfRightInverse` for the uniqueness lemma.
```
A .
| \
f | \ g
| \
v \β
B ----> C
β!Ο
```
-/
def liftOfRightInverse (hf : Function.RightInverse f_inv f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) where
toFun g := f.liftOfRightInverseAux f_inv hf g.1 g.2
invFun Ο := β¨Ο.comp f, fun x hx => (mem_ker _).mpr <| by simp [(mem_ker _).mp hx]β©
left_inv g := by
| Mathlib.RingTheory.Ideal.Operations.2319_0.5qK551sG47yBciY | /-- `liftOfRightInverse f hf g hg` is the unique ring homomorphism `Ο`
* such that `Ο.comp f = g` (`RingHom.liftOfRightInverse_comp`),
* where `f : A β+* B` has a right_inverse `f_inv` (`hf`),
* and `g : B β+* C` satisfies `hg : f.ker β€ g.ker`.
See `RingHom.eq_liftOfRightInverse` for the uniqueness lemma.
```
A .
| \
f | \ g
| \
v \β
B ----> C
β!Ο
```
-/
def liftOfRightInverse (hf : Function.RightInverse f_inv f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) where
toFun g | Mathlib_RingTheory_Ideal_Operations |
case a.a
A : Type u_1
B : Type u_2
C : Type u_3
instβΒ² : Ring A
instβΒΉ : Ring B
instβ : Ring C
f : A β+* B
f_inv : B β A
hf : Function.RightInverse f_inv βf
g : { g // ker f β€ ker g }
xβ : A
β’ β((fun Ο => { val := comp Ο f, property := (_ : β x β ker f, x β ker (comp Ο f)) })
((fun g => liftOfRightInverseAux f f_inv hf βg (_ : ker f β€ ker βg)) g))
xβ =
βg xβ | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β©
#align ideal.map_radical_of_surjective Ideal.map_radical_of_surjective
end CommRing
end Ideal
namespace Submodule
variable {R : Type u} {M : Type v}
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
-- TODO: show `[Algebra R A] : Algebra (Ideal R) A` too
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by simp
zero_smul := bot_smul
smul_zero := smul_bot
#align submodule.module_submodule Submodule.moduleSubmodule
end Submodule
namespace RingHom
variable {A B C : Type*} [Ring A] [Ring B] [Ring C]
variable (f : A β+* B) (f_inv : B β A)
/-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
exact hf 1
map_mul' := by
intro x y
rw [β map_mul g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_mul f]
simp only [hf _] }
#align ring_hom.lift_of_right_inverse_aux RingHom.liftOfRightInverseAux
@[simp]
theorem liftOfRightInverseAux_comp_apply (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) (a : A) :
(f.liftOfRightInverseAux f_inv hf g hg) (f a) = g a :=
f.toAddMonoidHom.liftOfRightInverse_comp_apply f_inv hf β¨g.toAddMonoidHom, hgβ© a
#align ring_hom.lift_of_right_inverse_aux_comp_apply RingHom.liftOfRightInverseAux_comp_apply
/-- `liftOfRightInverse f hf g hg` is the unique ring homomorphism `Ο`
* such that `Ο.comp f = g` (`RingHom.liftOfRightInverse_comp`),
* where `f : A β+* B` has a right_inverse `f_inv` (`hf`),
* and `g : B β+* C` satisfies `hg : f.ker β€ g.ker`.
See `RingHom.eq_liftOfRightInverse` for the uniqueness lemma.
```
A .
| \
f | \ g
| \
v \β
B ----> C
β!Ο
```
-/
def liftOfRightInverse (hf : Function.RightInverse f_inv f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) where
toFun g := f.liftOfRightInverseAux f_inv hf g.1 g.2
invFun Ο := β¨Ο.comp f, fun x hx => (mem_ker _).mpr <| by simp [(mem_ker _).mp hx]β©
left_inv g := by
ext
| simp only [comp_apply, liftOfRightInverseAux_comp_apply, Subtype.coe_mk] | /-- `liftOfRightInverse f hf g hg` is the unique ring homomorphism `Ο`
* such that `Ο.comp f = g` (`RingHom.liftOfRightInverse_comp`),
* where `f : A β+* B` has a right_inverse `f_inv` (`hf`),
* and `g : B β+* C` satisfies `hg : f.ker β€ g.ker`.
See `RingHom.eq_liftOfRightInverse` for the uniqueness lemma.
```
A .
| \
f | \ g
| \
v \β
B ----> C
β!Ο
```
-/
def liftOfRightInverse (hf : Function.RightInverse f_inv f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) where
toFun g := f.liftOfRightInverseAux f_inv hf g.1 g.2
invFun Ο := β¨Ο.comp f, fun x hx => (mem_ker _).mpr <| by simp [(mem_ker _).mp hx]β©
left_inv g := by
ext
| Mathlib.RingTheory.Ideal.Operations.2319_0.5qK551sG47yBciY | /-- `liftOfRightInverse f hf g hg` is the unique ring homomorphism `Ο`
* such that `Ο.comp f = g` (`RingHom.liftOfRightInverse_comp`),
* where `f : A β+* B` has a right_inverse `f_inv` (`hf`),
* and `g : B β+* C` satisfies `hg : f.ker β€ g.ker`.
See `RingHom.eq_liftOfRightInverse` for the uniqueness lemma.
```
A .
| \
f | \ g
| \
v \β
B ----> C
β!Ο
```
-/
def liftOfRightInverse (hf : Function.RightInverse f_inv f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) where
toFun g | Mathlib_RingTheory_Ideal_Operations |
A : Type u_1
B : Type u_2
C : Type u_3
instβΒ² : Ring A
instβΒΉ : Ring B
instβ : Ring C
f : A β+* B
f_inv : B β A
hf : Function.RightInverse f_inv βf
Ο : B β+* C
β’ (fun g => liftOfRightInverseAux f f_inv hf βg (_ : ker f β€ ker βg))
((fun Ο => { val := comp Ο f, property := (_ : β x β ker f, x β ker (comp Ο f)) }) Ο) =
Ο | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β©
#align ideal.map_radical_of_surjective Ideal.map_radical_of_surjective
end CommRing
end Ideal
namespace Submodule
variable {R : Type u} {M : Type v}
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
-- TODO: show `[Algebra R A] : Algebra (Ideal R) A` too
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by simp
zero_smul := bot_smul
smul_zero := smul_bot
#align submodule.module_submodule Submodule.moduleSubmodule
end Submodule
namespace RingHom
variable {A B C : Type*} [Ring A] [Ring B] [Ring C]
variable (f : A β+* B) (f_inv : B β A)
/-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
exact hf 1
map_mul' := by
intro x y
rw [β map_mul g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_mul f]
simp only [hf _] }
#align ring_hom.lift_of_right_inverse_aux RingHom.liftOfRightInverseAux
@[simp]
theorem liftOfRightInverseAux_comp_apply (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) (a : A) :
(f.liftOfRightInverseAux f_inv hf g hg) (f a) = g a :=
f.toAddMonoidHom.liftOfRightInverse_comp_apply f_inv hf β¨g.toAddMonoidHom, hgβ© a
#align ring_hom.lift_of_right_inverse_aux_comp_apply RingHom.liftOfRightInverseAux_comp_apply
/-- `liftOfRightInverse f hf g hg` is the unique ring homomorphism `Ο`
* such that `Ο.comp f = g` (`RingHom.liftOfRightInverse_comp`),
* where `f : A β+* B` has a right_inverse `f_inv` (`hf`),
* and `g : B β+* C` satisfies `hg : f.ker β€ g.ker`.
See `RingHom.eq_liftOfRightInverse` for the uniqueness lemma.
```
A .
| \
f | \ g
| \
v \β
B ----> C
β!Ο
```
-/
def liftOfRightInverse (hf : Function.RightInverse f_inv f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) where
toFun g := f.liftOfRightInverseAux f_inv hf g.1 g.2
invFun Ο := β¨Ο.comp f, fun x hx => (mem_ker _).mpr <| by simp [(mem_ker _).mp hx]β©
left_inv g := by
ext
simp only [comp_apply, liftOfRightInverseAux_comp_apply, Subtype.coe_mk]
right_inv Ο := by
| ext b | /-- `liftOfRightInverse f hf g hg` is the unique ring homomorphism `Ο`
* such that `Ο.comp f = g` (`RingHom.liftOfRightInverse_comp`),
* where `f : A β+* B` has a right_inverse `f_inv` (`hf`),
* and `g : B β+* C` satisfies `hg : f.ker β€ g.ker`.
See `RingHom.eq_liftOfRightInverse` for the uniqueness lemma.
```
A .
| \
f | \ g
| \
v \β
B ----> C
β!Ο
```
-/
def liftOfRightInverse (hf : Function.RightInverse f_inv f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) where
toFun g := f.liftOfRightInverseAux f_inv hf g.1 g.2
invFun Ο := β¨Ο.comp f, fun x hx => (mem_ker _).mpr <| by simp [(mem_ker _).mp hx]β©
left_inv g := by
ext
simp only [comp_apply, liftOfRightInverseAux_comp_apply, Subtype.coe_mk]
right_inv Ο := by
| Mathlib.RingTheory.Ideal.Operations.2319_0.5qK551sG47yBciY | /-- `liftOfRightInverse f hf g hg` is the unique ring homomorphism `Ο`
* such that `Ο.comp f = g` (`RingHom.liftOfRightInverse_comp`),
* where `f : A β+* B` has a right_inverse `f_inv` (`hf`),
* and `g : B β+* C` satisfies `hg : f.ker β€ g.ker`.
See `RingHom.eq_liftOfRightInverse` for the uniqueness lemma.
```
A .
| \
f | \ g
| \
v \β
B ----> C
β!Ο
```
-/
def liftOfRightInverse (hf : Function.RightInverse f_inv f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) where
toFun g | Mathlib_RingTheory_Ideal_Operations |
case a
A : Type u_1
B : Type u_2
C : Type u_3
instβΒ² : Ring A
instβΒΉ : Ring B
instβ : Ring C
f : A β+* B
f_inv : B β A
hf : Function.RightInverse f_inv βf
Ο : B β+* C
b : B
β’ ((fun g => liftOfRightInverseAux f f_inv hf βg (_ : ker f β€ ker βg))
((fun Ο => { val := comp Ο f, property := (_ : β x β ker f, x β ker (comp Ο f)) }) Ο))
b =
Ο b | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β©
#align ideal.map_radical_of_surjective Ideal.map_radical_of_surjective
end CommRing
end Ideal
namespace Submodule
variable {R : Type u} {M : Type v}
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
-- TODO: show `[Algebra R A] : Algebra (Ideal R) A` too
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by simp
zero_smul := bot_smul
smul_zero := smul_bot
#align submodule.module_submodule Submodule.moduleSubmodule
end Submodule
namespace RingHom
variable {A B C : Type*} [Ring A] [Ring B] [Ring C]
variable (f : A β+* B) (f_inv : B β A)
/-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
exact hf 1
map_mul' := by
intro x y
rw [β map_mul g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_mul f]
simp only [hf _] }
#align ring_hom.lift_of_right_inverse_aux RingHom.liftOfRightInverseAux
@[simp]
theorem liftOfRightInverseAux_comp_apply (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) (a : A) :
(f.liftOfRightInverseAux f_inv hf g hg) (f a) = g a :=
f.toAddMonoidHom.liftOfRightInverse_comp_apply f_inv hf β¨g.toAddMonoidHom, hgβ© a
#align ring_hom.lift_of_right_inverse_aux_comp_apply RingHom.liftOfRightInverseAux_comp_apply
/-- `liftOfRightInverse f hf g hg` is the unique ring homomorphism `Ο`
* such that `Ο.comp f = g` (`RingHom.liftOfRightInverse_comp`),
* where `f : A β+* B` has a right_inverse `f_inv` (`hf`),
* and `g : B β+* C` satisfies `hg : f.ker β€ g.ker`.
See `RingHom.eq_liftOfRightInverse` for the uniqueness lemma.
```
A .
| \
f | \ g
| \
v \β
B ----> C
β!Ο
```
-/
def liftOfRightInverse (hf : Function.RightInverse f_inv f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) where
toFun g := f.liftOfRightInverseAux f_inv hf g.1 g.2
invFun Ο := β¨Ο.comp f, fun x hx => (mem_ker _).mpr <| by simp [(mem_ker _).mp hx]β©
left_inv g := by
ext
simp only [comp_apply, liftOfRightInverseAux_comp_apply, Subtype.coe_mk]
right_inv Ο := by
ext b
| simp [liftOfRightInverseAux, hf b] | /-- `liftOfRightInverse f hf g hg` is the unique ring homomorphism `Ο`
* such that `Ο.comp f = g` (`RingHom.liftOfRightInverse_comp`),
* where `f : A β+* B` has a right_inverse `f_inv` (`hf`),
* and `g : B β+* C` satisfies `hg : f.ker β€ g.ker`.
See `RingHom.eq_liftOfRightInverse` for the uniqueness lemma.
```
A .
| \
f | \ g
| \
v \β
B ----> C
β!Ο
```
-/
def liftOfRightInverse (hf : Function.RightInverse f_inv f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) where
toFun g := f.liftOfRightInverseAux f_inv hf g.1 g.2
invFun Ο := β¨Ο.comp f, fun x hx => (mem_ker _).mpr <| by simp [(mem_ker _).mp hx]β©
left_inv g := by
ext
simp only [comp_apply, liftOfRightInverseAux_comp_apply, Subtype.coe_mk]
right_inv Ο := by
ext b
| Mathlib.RingTheory.Ideal.Operations.2319_0.5qK551sG47yBciY | /-- `liftOfRightInverse f hf g hg` is the unique ring homomorphism `Ο`
* such that `Ο.comp f = g` (`RingHom.liftOfRightInverse_comp`),
* where `f : A β+* B` has a right_inverse `f_inv` (`hf`),
* and `g : B β+* C` satisfies `hg : f.ker β€ g.ker`.
See `RingHom.eq_liftOfRightInverse` for the uniqueness lemma.
```
A .
| \
f | \ g
| \
v \β
B ----> C
β!Ο
```
-/
def liftOfRightInverse (hf : Function.RightInverse f_inv f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) where
toFun g | Mathlib_RingTheory_Ideal_Operations |
A : Type u_1
B : Type u_2
C : Type u_3
instβΒ² : Ring A
instβΒΉ : Ring B
instβ : Ring C
f : A β+* B
f_inv : B β A
hf : Function.RightInverse f_inv βf
g : A β+* C
hg : ker f β€ ker g
h : B β+* C
hh : comp h f = g
β’ h = (liftOfRightInverse f f_inv hf) { val := g, property := hg } | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β©
#align ideal.map_radical_of_surjective Ideal.map_radical_of_surjective
end CommRing
end Ideal
namespace Submodule
variable {R : Type u} {M : Type v}
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
-- TODO: show `[Algebra R A] : Algebra (Ideal R) A` too
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by simp
zero_smul := bot_smul
smul_zero := smul_bot
#align submodule.module_submodule Submodule.moduleSubmodule
end Submodule
namespace RingHom
variable {A B C : Type*} [Ring A] [Ring B] [Ring C]
variable (f : A β+* B) (f_inv : B β A)
/-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
exact hf 1
map_mul' := by
intro x y
rw [β map_mul g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_mul f]
simp only [hf _] }
#align ring_hom.lift_of_right_inverse_aux RingHom.liftOfRightInverseAux
@[simp]
theorem liftOfRightInverseAux_comp_apply (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) (a : A) :
(f.liftOfRightInverseAux f_inv hf g hg) (f a) = g a :=
f.toAddMonoidHom.liftOfRightInverse_comp_apply f_inv hf β¨g.toAddMonoidHom, hgβ© a
#align ring_hom.lift_of_right_inverse_aux_comp_apply RingHom.liftOfRightInverseAux_comp_apply
/-- `liftOfRightInverse f hf g hg` is the unique ring homomorphism `Ο`
* such that `Ο.comp f = g` (`RingHom.liftOfRightInverse_comp`),
* where `f : A β+* B` has a right_inverse `f_inv` (`hf`),
* and `g : B β+* C` satisfies `hg : f.ker β€ g.ker`.
See `RingHom.eq_liftOfRightInverse` for the uniqueness lemma.
```
A .
| \
f | \ g
| \
v \β
B ----> C
β!Ο
```
-/
def liftOfRightInverse (hf : Function.RightInverse f_inv f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) where
toFun g := f.liftOfRightInverseAux f_inv hf g.1 g.2
invFun Ο := β¨Ο.comp f, fun x hx => (mem_ker _).mpr <| by simp [(mem_ker _).mp hx]β©
left_inv g := by
ext
simp only [comp_apply, liftOfRightInverseAux_comp_apply, Subtype.coe_mk]
right_inv Ο := by
ext b
simp [liftOfRightInverseAux, hf b]
#align ring_hom.lift_of_right_inverse RingHom.liftOfRightInverse
/-- A non-computable version of `RingHom.liftOfRightInverse` for when no computable right
inverse is available, that uses `Function.surjInv`. -/
@[simp]
noncomputable abbrev liftOfSurjective (hf : Function.Surjective f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) :=
f.liftOfRightInverse (Function.surjInv hf) (Function.rightInverse_surjInv hf)
#align ring_hom.lift_of_surjective RingHom.liftOfSurjective
theorem liftOfRightInverse_comp_apply (hf : Function.RightInverse f_inv f)
(g : { g : A β+* C // RingHom.ker f β€ RingHom.ker g }) (x : A) :
(f.liftOfRightInverse f_inv hf g) (f x) = g.1 x :=
f.liftOfRightInverseAux_comp_apply f_inv hf g.1 g.2 x
#align ring_hom.lift_of_right_inverse_comp_apply RingHom.liftOfRightInverse_comp_apply
theorem liftOfRightInverse_comp (hf : Function.RightInverse f_inv f)
(g : { g : A β+* C // RingHom.ker f β€ RingHom.ker g }) :
(f.liftOfRightInverse f_inv hf g).comp f = g :=
RingHom.ext <| f.liftOfRightInverse_comp_apply f_inv hf g
#align ring_hom.lift_of_right_inverse_comp RingHom.liftOfRightInverse_comp
theorem eq_liftOfRightInverse (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) (h : B β+* C) (hh : h.comp f = g) :
h = f.liftOfRightInverse f_inv hf β¨g, hgβ© := by
| simp_rw [β hh] | theorem eq_liftOfRightInverse (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) (h : B β+* C) (hh : h.comp f = g) :
h = f.liftOfRightInverse f_inv hf β¨g, hgβ© := by
| Mathlib.RingTheory.Ideal.Operations.2369_0.5qK551sG47yBciY | theorem eq_liftOfRightInverse (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) (h : B β+* C) (hh : h.comp f = g) :
h = f.liftOfRightInverse f_inv hf β¨g, hgβ© | Mathlib_RingTheory_Ideal_Operations |
A : Type u_1
B : Type u_2
C : Type u_3
instβΒ² : Ring A
instβΒΉ : Ring B
instβ : Ring C
f : A β+* B
f_inv : B β A
hf : Function.RightInverse f_inv βf
g : A β+* C
hg : ker f β€ ker g
h : B β+* C
hh : comp h f = g
β’ h = (liftOfRightInverse f f_inv hf) { val := comp h f, property := (_ : (fun g => ker f β€ ker g) (comp h f)) } | /-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Ring.Equiv
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Basis.Bilinear
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
/-!
# More operations on modules and ideals
-/
universe u v w x
open BigOperators Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r β’ N = 0`. -/
def annihilator (N : Submodule R M) : Ideal R :=
LinearMap.ker (LinearMap.lsmul R N)
#align submodule.annihilator Submodule.annihilator
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) :=
β¨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) β¨n, hnβ©),
fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2β©
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (Hb : β r β I, β n β N, p (r β’ n))
(H1 : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact Hb _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(Hb : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(H1 : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by
refine' Exists.elim _ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, Hb _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, H1 _ _ _ _ hx hyβ©
#align submodule.smul_induction_on' Submodule.smul_induction_on'
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
x β I β’ span R ({m} : Set M) β β y β I, y β’ m = x :=
β¨fun hx =>
smul_induction_on hx
(fun r hri n hnm =>
let β¨s, hsβ© := mem_span_singleton.1 hnm
β¨r * s, I.mul_mem_right _ hri, hs βΈ mul_smul r s mβ©)
fun m1 m2 β¨y1, hyi1, hy1β© β¨y2, hyi2, hy2β© =>
β¨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]β©,
fun β¨y, hyi, hyβ© => hy βΈ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)β©
#align submodule.mem_smul_span_singleton Submodule.mem_smul_span_singleton
theorem smul_le_right : I β’ N β€ N :=
smul_le.2 fun r _ _ => N.smul_mem r
#align submodule.smul_le_right Submodule.smul_le_right
theorem smul_mono (hij : I β€ J) (hnp : N β€ P) : I β’ N β€ J β’ P :=
mapβ_le_mapβ hij hnp
#align submodule.smul_mono Submodule.smul_mono
theorem smul_mono_left (h : I β€ J) : I β’ N β€ J β’ N :=
mapβ_le_mapβ_left h
#align submodule.smul_mono_left Submodule.smul_mono_left
theorem smul_mono_right (h : N β€ P) : I β’ N β€ I β’ P :=
mapβ_le_mapβ_right h
#align submodule.smul_mono_right Submodule.smul_mono_right
theorem map_le_smul_top (I : Ideal R) (f : R ββ[R] M) :
Submodule.map f I β€ I β’ (β€ : Submodule R M) := by
rintro _ β¨y, hy, rflβ©
rw [β mul_one y, β smul_eq_mul, f.map_smul]
exact smul_mem_smul hy mem_top
#align submodule.map_le_smul_top Submodule.map_le_smul_top
@[simp]
theorem annihilator_smul (N : Submodule R M) : annihilator N β’ N = β₯ :=
eq_bot_iff.2 (smul_le.2 fun _ => mem_annihilator.1)
#align submodule.annihilator_smul Submodule.annihilator_smul
@[simp]
theorem annihilator_mul (I : Ideal R) : annihilator I * I = β₯ :=
annihilator_smul I
#align submodule.annihilator_mul Submodule.annihilator_mul
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = β₯ := by rw [mul_comm, annihilator_mul]
#align submodule.mul_annihilator Submodule.mul_annihilator
variable (I J N P)
@[simp]
theorem smul_bot : I β’ (β₯ : Submodule R M) = β₯ :=
mapβ_bot_right _ _
#align submodule.smul_bot Submodule.smul_bot
@[simp]
theorem bot_smul : (β₯ : Ideal R) β’ N = β₯ :=
mapβ_bot_left _ _
#align submodule.bot_smul Submodule.bot_smul
@[simp]
theorem top_smul : (β€ : Ideal R) β’ N = N :=
le_antisymm smul_le_right fun r hri => one_smul R r βΈ smul_mem_smul mem_top hri
#align submodule.top_smul Submodule.top_smul
theorem smul_sup : I β’ (N β P) = I β’ N β I β’ P :=
mapβ_sup_right _ _ _ _
#align submodule.smul_sup Submodule.smul_sup
theorem sup_smul : (I β J) β’ N = I β’ N β J β’ N :=
mapβ_sup_left _ _ _ _
#align submodule.sup_smul Submodule.sup_smul
protected theorem smul_assoc : (I β’ J) β’ N = I β’ J β’ N :=
le_antisymm
(smul_le.2 fun _ hrsij t htn =>
smul_induction_on hrsij
(fun r hr s hs =>
(@smul_eq_mul R _ r s).symm βΈ smul_smul r s t βΈ smul_mem_smul hr (smul_mem_smul hs htn))
fun x y => (add_smul x y t).symm βΈ Submodule.add_mem _)
(smul_le.2 fun r hr _ hsn =>
suffices J β’ N β€ Submodule.comap (r β’ (LinearMap.id : M ββ[R] M)) ((I β’ J) β’ N) from this hsn
smul_le.2 fun s hs n hn =>
show r β’ s β’ n β (I β’ J) β’ N from mul_smul r s n βΈ smul_mem_smul (smul_mem_smul hr hs) hn)
#align submodule.smul_assoc Submodule.smul_assoc
theorem smul_inf_le (Mβ Mβ : Submodule R M) : I β’ (Mβ β Mβ) β€ I β’ Mβ β I β’ Mβ :=
le_inf (Submodule.smul_mono_right inf_le_left) (Submodule.smul_mono_right inf_le_right)
#align submodule.smul_inf_le Submodule.smul_inf_le
theorem smul_iSup {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} : I β’ iSup t = β¨ i, I β’ t i :=
mapβ_iSup_right _ _ _
#align submodule.smul_supr Submodule.smul_iSup
theorem smul_iInf_le {ΞΉ : Sort*} {I : Ideal R} {t : ΞΉ β Submodule R M} :
I β’ iInf t β€ β¨
i, I β’ t i :=
le_iInf fun _ => smul_mono_right (iInf_le _ _)
#align submodule.smul_infi_le Submodule.smul_iInf_le
variable (S : Set R) (T : Set M)
theorem span_smul_span : Ideal.span S β’ span R T = span R (β (s β S) (t β T), {s β’ t}) :=
(mapβ_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
#align submodule.span_smul_span Submodule.span_smul_span
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
(Ideal.span {r} : Ideal R) β’ N = r β’ N := by
have : span R (β (t : M) (_ : t β N), {r β’ t}) = r β’ N := by
convert span_eq (r β’ N)
exact (Set.image_eq_iUnion _ (N : Set M)).symm
conv_lhs => rw [β span_eq N, span_smul_span]
simpa
#align submodule.ideal_span_singleton_smul Submodule.ideal_span_singleton_smul
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€) (x : M)
(H : β r : s, (r : R) β’ x β M') : x β M' := by
suffices (β€ : Ideal R) β’ span R ({x} : Set M) β€ M' by
rw [top_smul] at this
exact this (subset_span (Set.mem_singleton x))
rw [β hs, span_smul_span, span_le]
simpa using H
#align submodule.mem_of_span_top_of_smul_mem Submodule.mem_of_span_top_of_smul_mem
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n β’ x β M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = β€)
(x : M) (H : β r : s, β n : β, ((r : R) ^ n : R) β’ x β M') : x β M' := by
obtain β¨s', hsβ, hsββ© := (Ideal.span_eq_top_iff_finite _).mp hs
replace H : β r : s', β n : β, ((r : R) ^ n : R) β’ x β M' := fun r => H β¨_, hsβ r.2β©
choose nβ nβ using H
let N := s'.attach.sup nβ
have hs' := Ideal.span_pow_eq_top (s' : Set R) hsβ N
apply M'.mem_of_span_top_of_smul_mem _ hs'
rintro β¨_, r, hr, rflβ©
convert M'.smul_mem (r ^ (N - nβ β¨r, hrβ©)) (nβ β¨r, hrβ©) using 1
simp only [Subtype.coe_mk, smul_smul, β pow_add]
rw [tsub_add_cancel_of_le (Finset.le_sup (s'.mem_attach _) : nβ β¨r, hrβ© β€ N)]
#align submodule.mem_of_span_eq_top_of_smul_pow_mem Submodule.mem_of_span_eq_top_of_smul_pow_mem
variable {M' : Type w} [AddCommMonoid M'] [Module R M']
theorem map_smul'' (f : M ββ[R] M') : (I β’ N).map f = I β’ N.map f :=
le_antisymm
(map_le_iff_le_comap.2 <|
smul_le.2 fun r hr n hn =>
show f (r β’ n) β I β’ N.map f from
(f.map_smul r n).symm βΈ smul_mem_smul hr (mem_map_of_mem hn)) <|
smul_le.2 fun r hr _ hn =>
let β¨p, hp, hfpβ© := mem_map.1 hn
hfp βΈ f.map_smul r p βΈ mem_map_of_mem (smul_mem_smul hr hp)
#align submodule.map_smul'' Submodule.map_smul''
variable {I}
theorem mem_smul_span {s : Set M} {x : M} :
x β I β’ Submodule.span R s β x β Submodule.span R (β (a β I) (b β s), ({a β’ b} : Set M)) := by
rw [β I.span_eq, Submodule.span_smul_span, I.span_eq]
rfl
#align submodule.mem_smul_span Submodule.mem_smul_span
variable (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ΞΉ : Type*} (f : ΞΉ β M) (x : M) :
x β I β’ span R (Set.range f) β
β (a : ΞΉ ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x := by
constructor; swap
Β· rintro β¨a, ha, rflβ©
exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
refine' fun hx => span_induction (mem_smul_span.mp hx) _ _ _ _
Β· simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
rintro x β¨y, hy, x, β¨i, rflβ©, rflβ©
refine' β¨Finsupp.single i y, fun j => _, _β©
Β· letI := Classical.decEq ΞΉ
rw [Finsupp.single_apply]
split_ifs
Β· assumption
Β· exact I.zero_mem
refine' @Finsupp.sum_single_index ΞΉ R M _ _ i _ (fun i y => y β’ f i) _
simp
Β· exact β¨0, fun _ => I.zero_mem, Finsupp.sum_zero_indexβ©
Β· rintro x y β¨ax, hax, rflβ© β¨ay, hay, rflβ©
refine' β¨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' _ _β© <;> intros <;>
simp only [zero_smul, add_smul]
Β· rintro c x β¨a, ha, rflβ©
refine' β¨c β’ a, fun i => I.mul_mem_left c (ha i), _β©
rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
#align submodule.mem_ideal_smul_span_iff_exists_sum Submodule.mem_ideal_smul_span_iff_exists_sum
theorem mem_ideal_smul_span_iff_exists_sum' {ΞΉ : Type*} (s : Set ΞΉ) (f : ΞΉ β M) (x : M) :
x β I β’ span R (f '' s) β β (a : s ββ R) (_ : β i, a i β I), (a.sum fun i c => c β’ f i) = x :=
by rw [β Submodule.mem_ideal_smul_span_iff_exists_sum, β Set.image_eq_range]
#align submodule.mem_ideal_smul_span_iff_exists_sum' Submodule.mem_ideal_smul_span_iff_exists_sum'
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
x β I β’ (β€ : Submodule R N) β (x : M) β I β’ N := by
change _ β N.subtype x β I β’ N
have : Submodule.map N.subtype (I β’ β€) = I β’ N := by
rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
rw [β this]
exact (Function.Injective.mem_set_image N.injective_subtype).symm
#align submodule.mem_smul_top_iff Submodule.mem_smul_top_iff
@[simp]
theorem smul_comap_le_comap_smul (f : M ββ[R] M') (S : Submodule R M') (I : Ideal R) :
I β’ S.comap f β€ (I β’ S).comap f := by
refine' Submodule.smul_le.mpr fun r hr x hx => _
rw [Submodule.mem_comap] at hx β’
rw [f.map_smul]
exact Submodule.smul_mem_smul hr hx
#align submodule.smul_comap_le_comap_smul Submodule.smul_comap_le_comap_smul
end CommSemiring
section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]
variable {N Nβ Nβ P Pβ Pβ : Submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r β’ P β N`. -/
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r β N.colon P β β p β P, r β’ p β N :=
mem_annihilator.trans
β¨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ β¨p, hp, hpmβ© => hpm βΈ (N.mkQ.map_smul r p βΈ (Quotient.mk_eq_zero N).2 <| H p hp)β©
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r β N.colon P β P β€ comap (r β’ (LinearMap.id : M ββ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
theorem colon_mono (hn : Nβ β€ Nβ) (hp : Pβ β€ Pβ) : Nβ.colon Pβ β€ Nβ.colon Pβ := fun _ hrnp =>
mem_colon.2 fun pβ hpβ => hn <| mem_colon.1 hrnp pβ <| hp hpβ
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ΞΉβ : Sort w) (f : ΞΉβ β Submodule R M) (ΞΉβ : Sort x)
(g : ΞΉβ β Submodule R M) : (β¨
i, f i).colon (β¨ j, g j) = β¨
(i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r β N.colon (Submodule.span R {x}) β r β’ x β N :=
calc
r β N.colon (Submodule.span R {x}) β β a : R, r β’ a β’ x β N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ β r β’ x β N := by simp_rw [fun (a : R) β¦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r β I.colon (Ideal.span {x}) β r * x β I := by
simp only [β Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
#align ideal.mem_colon_singleton Ideal.mem_colon_singleton
end CommRing
end Submodule
namespace Ideal
section Add
variable {R : Type u} [Semiring R]
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I β J :=
rfl
#align ideal.add_eq_sup Ideal.add_eq_sup
@[simp]
theorem zero_eq_bot : (0 : Ideal R) = β₯ :=
rfl
#align ideal.zero_eq_bot Ideal.zero_eq_bot
@[simp]
theorem sum_eq_sup {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Ideal R) : s.sum f = s.sup f :=
rfl
#align ideal.sum_eq_sup Ideal.sum_eq_sup
end Add
section MulAndRadical
variable {R : Type u} {ΞΉ : Type*} [CommSemiring R]
variable {I J K L : Ideal R}
instance : Mul (Ideal R) :=
β¨(Β· β’ Β·)β©
@[simp]
theorem one_eq_top : (1 : Ideal R) = β€ := by erw [Submodule.one_eq_range, LinearMap.range_id]
#align ideal.one_eq_top Ideal.one_eq_top
theorem add_eq_one_iff : I + J = 1 β β i β I, β j β J, i + j = 1 := by
rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
theorem mul_mem_mul {r s} (hr : r β I) (hs : s β J) : r * s β I * J :=
Submodule.smul_mem_smul hr hs
#align ideal.mul_mem_mul Ideal.mul_mem_mul
theorem mul_mem_mul_rev {r s} (hr : r β I) (hs : s β J) : s * r β I * J :=
mul_comm r s βΈ mul_mem_mul hr hs
#align ideal.mul_mem_mul_rev Ideal.mul_mem_mul_rev
theorem pow_mem_pow {x : R} (hx : x β I) (n : β) : x ^ n β I ^ n :=
Submodule.pow_mem_pow _ hx _
#align ideal.pow_mem_pow Ideal.pow_mem_pow
theorem prod_mem_prod {ΞΉ : Type*} {s : Finset ΞΉ} {I : ΞΉ β Ideal R} {x : ΞΉ β R} :
(β i β s, x i β I i) β (β i in s, x i) β β i in s, I i := by
classical
refine Finset.induction_on s ?_ ?_
Β· intro
rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
exact Submodule.mem_top
Β· intro a s ha IH h
rw [Finset.prod_insert ha, Finset.prod_insert ha]
exact
mul_mem_mul (h a <| Finset.mem_insert_self a s)
(IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
#align ideal.prod_mem_prod Ideal.prod_mem_prod
theorem mul_le : I * J β€ K β β r β I, β s β J, r * s β K :=
Submodule.smul_le
#align ideal.mul_le Ideal.mul_le
theorem mul_le_left : I * J β€ J :=
Ideal.mul_le.2 fun _ _ _ => J.mul_mem_left _
#align ideal.mul_le_left Ideal.mul_le_left
theorem mul_le_right : I * J β€ I :=
Ideal.mul_le.2 fun _ hr _ _ => I.mul_mem_right _ hr
#align ideal.mul_le_right Ideal.mul_le_right
@[simp]
theorem sup_mul_right_self : I β I * J = I :=
sup_eq_left.2 Ideal.mul_le_right
#align ideal.sup_mul_right_self Ideal.sup_mul_right_self
@[simp]
theorem sup_mul_left_self : I β J * I = I :=
sup_eq_left.2 Ideal.mul_le_left
#align ideal.sup_mul_left_self Ideal.sup_mul_left_self
@[simp]
theorem mul_right_self_sup : I * J β I = I :=
sup_eq_right.2 Ideal.mul_le_right
#align ideal.mul_right_self_sup Ideal.mul_right_self_sup
@[simp]
theorem mul_left_self_sup : J * I β I = I :=
sup_eq_right.2 Ideal.mul_le_left
#align ideal.mul_left_self_sup Ideal.mul_left_self_sup
variable (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
(mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
#align ideal.mul_comm Ideal.mul_comm
protected theorem mul_assoc : I * J * K = I * (J * K) :=
Submodule.smul_assoc I J K
#align ideal.mul_assoc Ideal.mul_assoc
theorem span_mul_span (S T : Set R) : span S * span T = span (β (s β S) (t β T), {s * t}) :=
Submodule.span_smul_span S T
#align ideal.span_mul_span Ideal.span_mul_span
variable {I J K}
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
unfold span
rw [Submodule.span_mul_span]
#align ideal.span_mul_span' Ideal.span_mul_span'
theorem span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : Ideal R) := by
unfold span
rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
#align ideal.span_singleton_mul_span_singleton Ideal.span_singleton_mul_span_singleton
theorem span_singleton_pow (s : R) (n : β) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
induction' n with n ih; Β· simp [Set.singleton_one]
simp only [pow_succ, ih, span_singleton_mul_span_singleton]
#align ideal.span_singleton_pow Ideal.span_singleton_pow
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x β I * span {y} β β z β I, z * y = x :=
Submodule.mem_smul_span_singleton
#align ideal.mem_mul_span_singleton Ideal.mem_mul_span_singleton
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x β span {y} * I β β z β I, y * z = x := by
simp only [mul_comm, mem_mul_span_singleton]
#align ideal.mem_span_singleton_mul Ideal.mem_span_singleton_mul
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
I β€ span {x} * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (_ : zI β I), zI β span {x} * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_span_singleton_mul]
#align ideal.le_span_singleton_mul_iff Ideal.le_span_singleton_mul_iff
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
span {x} * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
constructor
Β· intro h zI hzI
exact h x (dvd_refl x) zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [mul_comm x z, mul_assoc]
exact J.mul_mem_left _ (h zI hzI)
#align ideal.span_singleton_mul_le_iff Ideal.span_singleton_mul_le_iff
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
span {x} * I β€ span {y} * J β β zI β I, β zJ β J, x * zI = y * zJ := by
simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_le_span_singleton_mul Ideal.span_singleton_mul_le_span_singleton_mul
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I β€ span {x} * J β I β€ J := by
simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
exists_eq_right', SetLike.le_def]
#align ideal.span_singleton_mul_right_mono Ideal.span_singleton_mul_right_mono
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} β€ J * span {x} β I β€ J := by
simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
#align ideal.span_singleton_mul_left_mono Ideal.span_singleton_mul_left_mono
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x β 0) :
span {x} * I = span {x} * J β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
#align ideal.span_singleton_mul_right_inj Ideal.span_singleton_mul_right_inj
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x β 0) :
I * span {x} = J * span {x} β I = J := by
simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
#align ideal.span_singleton_mul_left_inj Ideal.span_singleton_mul_left_inj
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective ((span {x} : Ideal R) * Β·) := fun _ _ =>
(span_singleton_mul_right_inj hx).mp
#align ideal.span_singleton_mul_right_injective Ideal.span_singleton_mul_right_injective
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x β 0) :
Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
(span_singleton_mul_left_inj hx).mp
#align ideal.span_singleton_mul_left_injective Ideal.span_singleton_mul_left_injective
theorem eq_span_singleton_mul {x : R} (I J : Ideal R) :
I = span {x} * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
#align ideal.eq_span_singleton_mul Ideal.eq_span_singleton_mul
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
span {x} * I = span {y} * J β
(β zI β I, β zJ β J, x * zI = y * zJ) β§ β zJ β J, β zI β I, x * zI = y * zJ :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
#align ideal.span_singleton_mul_eq_span_singleton_mul Ideal.span_singleton_mul_eq_span_singleton_mul
theorem prod_span {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β Set R) :
(β i in s, Ideal.span (I i)) = Ideal.span (β i in s, I i) :=
Submodule.prod_span s I
#align ideal.prod_span Ideal.prod_span
theorem prod_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R) :
(β i in s, Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} :=
Submodule.prod_span_singleton s I
#align ideal.prod_span_singleton Ideal.prod_span_singleton
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
(m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
Multiset.induction_on m (by simp) fun a m ih => by
simp only [Multiset.map_cons, Multiset.prod_cons, ih, β Ideal.span_singleton_mul_span_singleton]
#align ideal.multiset_prod_span_singleton Ideal.multiset_prod_span_singleton
theorem finset_inf_span_singleton {ΞΉ : Type*} (s : Finset ΞΉ) (I : ΞΉ β R)
(hI : Set.Pairwise (βs) (IsCoprime on I)) :
(s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {β i in s, I i} := by
ext x
simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
exact β¨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans hβ©
#align ideal.finset_inf_span_singleton Ideal.finset_inf_span_singleton
theorem iInf_span_singleton {ΞΉ : Type*} [Fintype ΞΉ] {I : ΞΉ β R}
(hI : β (i j) (_ : i β j), IsCoprime (I i) (I j)) :
β¨
i, span ({I i} : Set R) = span {β i, I i} := by
rw [β Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
rwa [Finset.coe_univ, Set.pairwise_univ]
#align ideal.infi_span_singleton Ideal.iInf_span_singleton
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ΞΉ : Type*} [Fintype ΞΉ]
{I : ΞΉ β β} (hI : β (i j : ΞΉ), i β j β (I i).Coprime (I j)) :
β¨
(i : ΞΉ), span {(I i : R)} = span {((β i : ΞΉ, I i : β) : R)} := by
rw [iInf_span_singleton, Nat.cast_prod]
exact fun i j h β¦ (hI i j h).cast
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
span ({x} : Set R) β span {y} = β€ β IsCoprime x y := by
rw [eq_top_iff_one, Submodule.mem_sup]
constructor
Β· rintro β¨u, hu, v, hv, h1β©
rw [mem_span_singleton'] at hu hv
rw [β hu.choose_spec, β hv.choose_spec] at h1
exact β¨_, _, h1β©
Β· exact fun β¨u, v, h1β© =>
β¨_, mem_span_singleton'.mpr β¨_, rflβ©, _, mem_span_singleton'.mpr β¨_, rflβ©, h1β©
#align ideal.sup_eq_top_iff_is_coprime Ideal.sup_eq_top_iff_isCoprime
theorem mul_le_inf : I * J β€ I β J :=
mul_le.2 fun r hri s hsj => β¨I.mul_mem_right s hri, J.mul_mem_left r hsjβ©
#align ideal.mul_le_inf Ideal.mul_le_inf
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod β€ s.inf := by
classical
refine' s.induction_on _ _
Β· rw [Multiset.inf_zero]
exact le_top
intro a s ih
rw [Multiset.prod_cons, Multiset.inf_cons]
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
#align ideal.multiset_prod_le_inf Ideal.multiset_prod_le_inf
theorem prod_le_inf {s : Finset ΞΉ} {f : ΞΉ β Ideal R} : s.prod f β€ s.inf f :=
multiset_prod_le_inf
#align ideal.prod_le_inf Ideal.prod_le_inf
theorem mul_eq_inf_of_coprime (h : I β J = β€) : I * J = I β J :=
le_antisymm mul_le_inf fun r β¨hri, hrjβ© =>
let β¨s, hsi, t, htj, hstβ© := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
mul_one r βΈ
hst βΈ
(mul_add r s t).symm βΈ Ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
#align ideal.mul_eq_inf_of_coprime Ideal.mul_eq_inf_of_coprime
theorem sup_mul_eq_of_coprime_left (h : I β J = β€) : I β J * K = I β K :=
le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi β’
obtain β¨i1, hi1, j, hj, hβ© := h; obtain β¨i', hi', k, hk, hiβ© := hi
refine' β¨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _β©
rw [add_assoc, β add_mul, h, one_mul, hi]
#align ideal.sup_mul_eq_of_coprime_left Ideal.sup_mul_eq_of_coprime_left
theorem sup_mul_eq_of_coprime_right (h : I β K = β€) : I β J * K = I β J := by
rw [mul_comm]
exact sup_mul_eq_of_coprime_left h
#align ideal.sup_mul_eq_of_coprime_right Ideal.sup_mul_eq_of_coprime_right
theorem mul_sup_eq_of_coprime_left (h : I β J = β€) : I * K β J = K β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_left Ideal.mul_sup_eq_of_coprime_left
theorem mul_sup_eq_of_coprime_right (h : K β J = β€) : I * K β J = I β J := by
rw [sup_comm] at h
rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
#align ideal.mul_sup_eq_of_coprime_right Ideal.mul_sup_eq_of_coprime_right
theorem sup_prod_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β i in s, J i) = β€ :=
Finset.prod_induction _ (fun J => I β J = β€)
(fun J K hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
(by simp_rw [one_eq_top, sup_top_eq]) h
#align ideal.sup_prod_eq_top Ideal.sup_prod_eq_top
theorem sup_iInf_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β I β J i = β€) :
(I β β¨
i β s, J i) = β€ :=
eq_top_iff.mpr <|
le_of_eq_of_le (sup_prod_eq_top h).symm <|
sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
#align ideal.sup_infi_eq_top Ideal.sup_iInf_eq_top
theorem prod_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β i in s, J i) β I = β€ :=
sup_comm.trans (sup_prod_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.prod_sup_eq_top Ideal.prod_sup_eq_top
theorem iInf_sup_eq_top {s : Finset ΞΉ} {J : ΞΉ β Ideal R} (h : β i, i β s β J i β I = β€) :
(β¨
i β s, J i) β I = β€ :=
sup_comm.trans (sup_iInf_eq_top fun i hi => sup_comm.trans <| h i hi)
#align ideal.infi_sup_eq_top Ideal.iInf_sup_eq_top
theorem sup_pow_eq_top {n : β} (h : I β J = β€) : I β J ^ n = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact sup_prod_eq_top fun _ _ => h
#align ideal.sup_pow_eq_top Ideal.sup_pow_eq_top
theorem pow_sup_eq_top {n : β} (h : I β J = β€) : I ^ n β J = β€ := by
rw [β Finset.card_range n, β Finset.prod_const]
exact prod_sup_eq_top fun _ _ => h
#align ideal.pow_sup_eq_top Ideal.pow_sup_eq_top
theorem pow_sup_pow_eq_top {m n : β} (h : I β J = β€) : I ^ m β J ^ n = β€ :=
sup_pow_eq_top (pow_sup_eq_top h)
#align ideal.pow_sup_pow_eq_top Ideal.pow_sup_pow_eq_top
variable (I)
-- @[simp] -- Porting note: simp can prove this
theorem mul_bot : I * β₯ = β₯ := by simp
#align ideal.mul_bot Ideal.mul_bot
-- @[simp] -- Porting note: simp can prove this
theorem bot_mul : β₯ * I = β₯ := by simp
#align ideal.bot_mul Ideal.bot_mul
@[simp]
theorem mul_top : I * β€ = I :=
Ideal.mul_comm β€ I βΈ Submodule.top_smul I
#align ideal.mul_top Ideal.mul_top
@[simp]
theorem top_mul : β€ * I = I :=
Submodule.top_smul I
#align ideal.top_mul Ideal.top_mul
variable {I}
theorem mul_mono (hik : I β€ K) (hjl : J β€ L) : I * J β€ K * L :=
Submodule.smul_mono hik hjl
#align ideal.mul_mono Ideal.mul_mono
theorem mul_mono_left (h : I β€ J) : I * K β€ J * K :=
Submodule.smul_mono_left h
#align ideal.mul_mono_left Ideal.mul_mono_left
theorem mul_mono_right (h : J β€ K) : I * J β€ I * K :=
Submodule.smul_mono_right h
#align ideal.mul_mono_right Ideal.mul_mono_right
variable (I J K)
theorem mul_sup : I * (J β K) = I * J β I * K :=
Submodule.smul_sup I J K
#align ideal.mul_sup Ideal.mul_sup
theorem sup_mul : (I β J) * K = I * K β J * K :=
Submodule.sup_smul I J K
#align ideal.sup_mul Ideal.sup_mul
variable {I J K}
theorem pow_le_pow_right {m n : β} (h : m β€ n) : I ^ n β€ I ^ m := by
cases' Nat.exists_eq_add_of_le h with k hk
rw [hk, pow_add]
exact le_trans mul_le_inf inf_le_left
#align ideal.pow_le_pow_right Ideal.pow_le_pow_right
theorem pow_le_self {n : β} (hn : n β 0) : I ^ n β€ I :=
calc
I ^ n β€ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
_ = I := pow_one _
#align ideal.pow_le_self Ideal.pow_le_self
theorem pow_right_mono {I J : Ideal R} (e : I β€ J) (n : β) : I ^ n β€ J ^ n := by
induction' n with _ hn
Β· rw [pow_zero, pow_zero]
Β· rw [pow_succ, pow_succ]
exact Ideal.mul_mono e hn
#align ideal.pow_right_mono Ideal.pow_right_mono
theorem mul_eq_bot {R : Type*} [CommSemiring R] [NoZeroDivisors R] {I J : Ideal R} :
I * J = β₯ β I = β₯ β¨ J = β₯ :=
β¨fun hij =>
or_iff_not_imp_left.mpr fun I_ne_bot =>
J.eq_bot_iff.mpr fun j hj =>
let β¨i, hi, ne0β© := I.ne_bot_iff.mp I_ne_bot
Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
fun h => by cases' h with h h <;> rw [β Ideal.mul_bot, h, Ideal.mul_comm]β©
#align ideal.mul_eq_bot Ideal.mul_eq_bot
instance {R : Type*} [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
theorem prod_eq_bot {R : Type*} [CommRing R] [IsDomain R] {s : Multiset (Ideal R)} :
s.prod = β₯ β β I β s, I = β₯ := by
rw [bot_eq_zero, prod_zero_iff_exists_zero]
simp
#align ideal.prod_eq_bot Ideal.prod_eq_bot
theorem span_pair_mul_span_pair (w x y z : R) :
(span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
#align ideal.span_pair_mul_span_pair Ideal.span_pair_mul_span_pair
theorem isCoprime_iff_codisjoint : IsCoprime I J β Codisjoint I J := by
rw [IsCoprime, codisjoint_iff]
constructor
Β· rintro β¨x, y, hxyβ©
rw [eq_top_iff_one]
apply (show x * I + y * J β€ I β J from
sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
rw [hxy]
simp only [one_eq_top, Submodule.mem_top]
Β· intro h
refine' β¨1, 1, _β©
simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
theorem isCoprime_iff_add : IsCoprime I J β I + J = 1 := by
rw [isCoprime_iff_codisjoint, codisjoint_iff, add_eq_sup, one_eq_top]
theorem isCoprime_iff_exists : IsCoprime I J β β i β I, β j β J, i + j = 1 := by
rw [β add_eq_one_iff, isCoprime_iff_add]
theorem isCoprime_iff_sup_eq : IsCoprime I J β I β J = β€ := by
rw [isCoprime_iff_codisjoint, codisjoint_iff]
open List in
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
β i β I, β j β J, i + j = 1, I β J = β€] := by
rw [β isCoprime_iff_codisjoint, β isCoprime_iff_add, β isCoprime_iff_exists,
β isCoprime_iff_sup_eq]
simp
theorem _root_.IsCoprime.codisjoint (h : IsCoprime I J) : Codisjoint I J :=
isCoprime_iff_codisjoint.mp h
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
theorem _root_.IsCoprime.exists (h : IsCoprime I J) : β i β I, β j β J, i + j = 1 :=
isCoprime_iff_exists.mp h
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I β J = β€ := isCoprime_iff_sup_eq.mp h
theorem isCoprime_span_singleton_iff (x y : R) :
IsCoprime (span <| singleton x) (span <| singleton y) β IsCoprime x y := by
simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
mem_span_singleton]
constructor
Β· rintro β¨a, _, β¨b, rflβ©, eβ©; exact β¨a, b, mul_comm b y βΈ eβ©
Β· rintro β¨a, b, eβ©; exact β¨a, _, β¨b, rflβ©, mul_comm y b βΈ eβ©
theorem isCoprime_biInf {J : ΞΉ β Ideal R} {s : Finset ΞΉ}
(hf : β j β s, IsCoprime I (J j)) : IsCoprime I (β¨
j β s, J j) := by
classical
simp_rw [isCoprime_iff_add] at *
induction s using Finset.induction with
| empty =>
simp
| @insert i s _ hs =>
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, β one_eq_top]
set K := β¨
j β s, J j
calc
1 = I + K := (hs fun j hj β¦ hf j (Finset.mem_insert_of_mem hj)).symm
_ = I + K*(I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
_ = (1+K)*I + K*J i := by ring
_ β€ I + K β J i := add_le_add mul_le_left mul_le_inf
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n β I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
carrier := { r | β n : β, r ^ n β I }
zero_mem' := β¨1, (pow_one (0 : R)).symm βΈ I.zero_memβ©
add_mem' :=
fun {x y} β¨m, hxmiβ© β¨n, hyniβ© =>
β¨m + n,
(add_pow x y (m + n)).symm βΈ I.sum_mem <|
show
β c β Finset.range (Nat.succ (m + n)), x ^ c * y ^ (m + n - c) * Nat.choose (m + n) c β I
from fun c _ =>
Or.casesOn (le_total c m) (fun hcm =>
I.mul_mem_right _ <|
I.mul_mem_left _ <|
Nat.add_comm n m βΈ
(add_tsub_assoc_of_le hcm n).symm βΈ
(pow_add y n (m - c)).symm βΈ I.mul_mem_right _ hyni) (fun hmc =>
I.mul_mem_right _ <|
I.mul_mem_right _ <|
add_tsub_cancel_of_le hmc βΈ (pow_add x m (c - m)).symm βΈ I.mul_mem_right _ hxmi)β©
-- Porting note: Below gives weird errors without `by exact`
smul_mem' {r s} := by exact fun β¨n, hβ© β¦ β¨n, (mul_pow r s n).symm βΈ I.mul_mem_left (r ^ n) hβ©
#align ideal.radical Ideal.radical
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
I.radical β€ I
#align ideal.is_radical Ideal.IsRadical
theorem le_radical : I β€ radical I := fun r hri => β¨1, (pow_one r).symm βΈ hriβ©
#align ideal.le_radical Ideal.le_radical
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I β I.IsRadical := by
rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
#align ideal.radical_eq_iff Ideal.radical_eq_iff
alias β¨_, IsRadical.radicalβ© := radical_eq_iff
#align ideal.is_radical.radical Ideal.IsRadical.radical
variable (R)
theorem radical_top : (radical β€ : Ideal R) = β€ :=
(eq_top_iff_one _).2 β¨0, Submodule.mem_topβ©
#align ideal.radical_top Ideal.radical_top
variable {R}
theorem radical_mono (H : I β€ J) : radical I β€ radical J := fun _ β¨n, hrniβ© => β¨n, H hrniβ©
#align ideal.radical_mono Ideal.radical_mono
variable (I)
theorem radical_isRadical : (radical I).IsRadical := fun r β¨n, k, hrnkiβ© =>
β¨n * k, (pow_mul r n k).symm βΈ hrnkiβ©
#align ideal.radical_is_radical Ideal.radical_isRadical
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
(radical_isRadical I).radical
#align ideal.radical_idem Ideal.radical_idem
variable {I}
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical β€ J β I β€ J :=
β¨le_trans le_radical, fun h => hJ.radical βΈ radical_mono hβ©
#align ideal.is_radical.radical_le_iff Ideal.IsRadical.radical_le_iff
theorem radical_le_radical_iff : radical I β€ radical J β I β€ radical J :=
(radical_isRadical J).radical_le_iff
#align ideal.radical_le_radical_iff Ideal.radical_le_radical_iff
theorem radical_eq_top : radical I = β€ β I = β€ :=
β¨fun h =>
(eq_top_iff_one _).2 <|
let β¨n, hnβ© := (eq_top_iff_one _).1 h
@one_pow R _ n βΈ hn,
fun h => h.symm βΈ radical_top Rβ©
#align ideal.radical_eq_top Ideal.radical_eq_top
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ β¨n, hrniβ© =>
H.mem_of_pow_mem n hrni
#align ideal.is_prime.is_radical Ideal.IsPrime.isRadical
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
IsRadical.radical H.isRadical
#align ideal.is_prime.radical Ideal.IsPrime.radical
variable (I J)
theorem radical_sup : radical (I β J) = radical (radical I β radical J) :=
le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
#align ideal.radical_sup Ideal.radical_sup
theorem radical_inf : radical (I β J) = radical I β radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ I.mul_mem_right _ hrm,
(pow_add r m n).symm βΈ J.mul_mem_left _ hrnβ©
#align ideal.radical_inf Ideal.radical_inf
theorem radical_mul : radical (I * J) = radical I β radical J := by
refine le_antisymm ?_ fun r β¨β¨m, hrmβ©, β¨n, hrnβ©β© =>
β¨m + n, (pow_add r m n).symm βΈ mul_mem_mul hrm hrnβ©
have := radical_mono <| @mul_le_inf _ _ I J
simp_rw [radical_inf I J] at this
assumption
#align ideal.radical_mul Ideal.radical_mul
variable {I J}
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical β€ J β I β€ J :=
IsRadical.radical_le_iff hJ.isRadical
#align ideal.is_prime.radical_le_iff Ideal.IsPrime.radical_le_iff
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I β€ J β§ IsPrime J } :=
le_antisymm (le_sInf fun J hJ β¦ hJ.2.radical_le_iff.2 hJ.1) fun r hr β¦
by_contradiction fun hri β¦
let β¨m, (hrm : r β radical m), him, hmβ© :=
zorn_nonempty_partialOrderβ { K : Ideal R | r β radical K }
(fun c hc hcc y hyc =>
β¨sSup c, fun β¨n, hrncβ© =>
let β¨y, hyc, hrnyβ© := (Submodule.mem_sSup_of_directed β¨y, hycβ© hcc.directedOn).1 hrnc
hc hyc β¨n, hrnyβ©,
fun z => le_sSupβ©)
I hri
have : β (x) (_ : x β m), r β radical (m β span {x}) := fun x hxm =>
by_contradiction fun hrmx =>
hxm <|
hm (m β span {x}) hrmx le_sup_left βΈ
(le_sup_right : _ β€ m β span {x}) (subset_span <| Set.mem_singleton _)
have : IsPrime m :=
β¨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
or_iff_not_imp_left.2 fun hxm =>
by_contradiction fun hym =>
let β¨n, hrnβ© := this _ hxm
let β¨p, hpm, q, hq, hpqrnβ© := Submodule.mem_sup.1 hrn
let β¨c, hcxqβ© := mem_span_singleton'.1 hq
let β¨k, hrkβ© := this _ hym
let β¨f, hfm, g, hg, hfgrkβ© := Submodule.mem_sup.1 hrk
let β¨d, hdygβ© := mem_span_singleton'.1 hg
hrm
β¨n + k, by
rw [pow_add, β hpqrn, β hcxq, β hfgrk, β hdyg, add_mul, mul_add (c * x),
mul_assoc c x (d * y), mul_left_comm x, β mul_assoc];
refine'
m.add_mem (m.mul_mem_right _ hpm)
(m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))β©β©
hrm <|
this.radical.symm βΈ (sInf_le β¨him, thisβ© : sInf { J : Ideal R | I β€ J β§ IsPrime J } β€ m) hr
#align ideal.radical_eq_Inf Ideal.radical_eq_sInf
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
(β₯ : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
#align ideal.is_radical_bot_of_no_zero_divisors Ideal.isRadical_bot_of_noZeroDivisors
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
radical (β₯ : Ideal R) = β₯ :=
eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
#align ideal.radical_bot_of_no_zero_divisors Ideal.radical_bot_of_noZeroDivisors
instance : IdemCommSemiring (Ideal R) :=
inferInstance
variable (R)
theorem top_pow (n : β) : (β€ ^ n : Ideal R) = β€ :=
Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
#align ideal.top_pow Ideal.top_pow
variable {R}
variable (I)
theorem radical_pow (n : β) (H : n > 0) : radical (I ^ n) = radical I :=
Nat.recOn n (Not.elim (by decide))
(fun n ih H =>
Or.casesOn (lt_or_eq_of_le <| Nat.le_of_lt_succ H)
(fun H =>
calc
radical (I ^ (n + 1)) = radical I β radical (I ^ n) := by
rw [pow_succ]
exact radical_mul _ _
_ = radical I β radical I := by rw [ih H]
_ = radical I := inf_idem
)
fun H => H βΈ (pow_one I).symm βΈ rfl)
H
#align ideal.radical_pow Ideal.radical_pow
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J β€ P β I β€ P β¨ J β€ P := by
rw [or_comm, Ideal.mul_le]
simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, β forall_or_left, or_comm, forall_or_left]
#align ideal.is_prime.mul_le Ideal.IsPrime.mul_le
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I β J β€ P β I β€ P β¨ J β€ P :=
β¨fun h β¦ hp.mul_le.1 <| mul_le_inf.trans h, fun h β¦ h.elim inf_le_left.trans inf_le_right.transβ©
#align ideal.is_prime.inf_le Ideal.IsPrime.inf_le
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
s.prod β€ P β β I β s, I β€ P :=
s.induction_on (by simp [hp.ne_top]) fun I s ih β¦ by simp [hp.mul_le, ih]
#align ideal.is_prime.multiset_prod_le Ideal.IsPrime.multiset_prod_le
theorem IsPrime.multiset_prod_map_le {s : Multiset ΞΉ} (f : ΞΉ β Ideal R) {P : Ideal R}
(hp : IsPrime P) : (s.map f).prod β€ P β β i β s, f i β€ P := by
simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
#align ideal.is_prime.multiset_prod_map_le Ideal.IsPrime.multiset_prod_map_le
theorem IsPrime.prod_le {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.prod f β€ P β β i β s, f i β€ P :=
hp.multiset_prod_map_le f
#align ideal.is_prime.prod_le Ideal.IsPrime.prod_le
theorem IsPrime.inf_le' {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {P : Ideal R} (hp : IsPrime P) :
s.inf f β€ P β β i β s, f i β€ P :=
β¨fun h β¦ hp.prod_le.1 <| prod_le_inf.trans h, fun β¨_, his, hipβ© β¦ (Finset.inf_le his).trans hipβ©
#align ideal.is_prime.inf_le' Ideal.IsPrime.inf_le'
-- Porting note: needed to add explicit coercions (Β· : Set R).
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
(I : Set R) β J βͺ K β I β€ J β¨ I β€ K :=
AddSubgroupClass.subset_union
#align ideal.subset_union Ideal.subset_union
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} {a b : ΞΉ}
(hp : β i β s, IsPrime (f i)) {I : Ideal R} :
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i := by
suffices
((I : Set R) β f a βͺ f b βͺ β i β (βs : Set ΞΉ), f i) β I β€ f a β¨ I β€ f b β¨ β i β s, I β€ f i from
β¨this, fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_left _ _) (Set.subset_union_left _ _))
fun h =>
Or.casesOn h
(fun h =>
Set.Subset.trans h <|
Set.Subset.trans (Set.subset_union_right _ _) (Set.subset_union_left _ _))
fun β¨i, his, hiβ© => by
refine' Set.Subset.trans hi <| Set.Subset.trans _ <| Set.subset_union_right _ _;
exact Set.subset_biUnion_of_mem (u := fun x β¦ (f x : Set R)) (Finset.mem_coe.2 his)β©
generalize hn : s.card = n; intro h
induction' n with n ih generalizing a b s
Β· clear hp
rw [Finset.card_eq_zero] at hn
subst hn
rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
simpa only [exists_prop, Finset.not_mem_empty, false_and_iff, exists_false, or_false_iff]
classical
replace hn : β (i : ΞΉ) (t : Finset ΞΉ), i β t β§ insert i t = s β§ t.card = n :=
Finset.card_eq_succ.1 hn
rcases hn with β¨i, t, hit, rfl, hnβ©
replace hp : IsPrime (f i) β§ β x β t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
by_cases Ht : β j β t, f j β€ f i
Β· obtain β¨j, hjt, hfjiβ© : β j β t, f j β€ f i := Ht
obtain β¨u, hju, rflβ© : β u, j β u β§ insert j u = t :=
β¨t.erase j, t.not_mem_erase j, Finset.insert_erase hjtβ©
have hp' : β k β insert i u, IsPrime (f k) := by
rw [Finset.forall_mem_insert] at hp β’
exact β¨hp.1, hp.2.2β©
have hiu : i β u := mt Finset.mem_insert_of_mem hit
have hn' : (insert i u).card = n := by
rwa [Finset.card_insert_of_not_mem] at hn β’
exacts [hiu, hju]
have h' : (I : Set R) β f a βͺ f b βͺ β k β (β(insert i u) : Set ΞΉ), f k := by
rw [Finset.coe_insert] at h β’
rw [Finset.coe_insert] at h
simp only [Set.biUnion_insert] at h β’
rw [β Set.union_assoc (f i : Set R)] at h
erw [Set.union_eq_self_of_subset_right hfji] at h
exact h
specialize ih hp' hn' h'
refine' ih.imp id (Or.imp id (Exists.imp fun k => _))
exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
by_cases Ha : f a β€ f i
Β· have h' : (I : Set R) β f i βͺ f b βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_right_comm (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Ha] at h
exact h
specialize ih hp.2 hn h'
right
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inr β¨i, Finset.mem_insert_self i t, ihβ©
Β· exact Or.inl ih
Β· exact Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©
by_cases Hb : f b β€ f i
Β· have h' : (I : Set R) β f a βͺ f i βͺ β j β (βt : Set ΞΉ), f j := by
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_assoc,
Set.union_assoc (f a : Set R)] at h
erw [Set.union_eq_self_of_subset_left Hb] at h
exact h
specialize ih hp.2 hn h'
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· exact Or.inl ih
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, ihβ©)
Β· exact Or.inr (Or.inr β¨k, Finset.mem_insert_of_mem hkt, ihβ©)
by_cases Hi : I β€ f i
Β· exact Or.inr (Or.inr β¨i, Finset.mem_insert_self i t, Hiβ©)
have : Β¬I β f a β f b β t.inf f β€ f i := by
simp only [hp.1.inf_le, hp.1.inf_le', not_or]
exact β¨β¨β¨Hi, Haβ©, Hbβ©, Htβ©
rcases Set.not_subset.1 this with β¨r, β¨β¨β¨hrI, hraβ©, hrbβ©, hrβ©, hriβ©
by_cases HI : (I : Set R) β f a βͺ f b βͺ β j β (βt : Set ΞΉ), f j
Β· specialize ih hp.2 hn HI
rcases ih with (ih | ih | β¨k, hkt, ihβ©)
Β· left
exact ih
Β· right
left
exact ih
Β· right
right
exact β¨k, Finset.mem_insert_of_mem hkt, ihβ©
exfalso
rcases Set.not_subset.1 HI with β¨s, hsI, hsβ©
rw [Finset.coe_insert, Set.biUnion_insert] at h
have hsi : s β f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
rcases h (I.add_mem hrI hsI) with (β¨ha | hbβ© | hi | ht)
Β· exact hs (Or.inl <| Or.inl <| add_sub_cancel' r s βΈ (f a).sub_mem ha hra)
Β· exact hs (Or.inl <| Or.inr <| add_sub_cancel' r s βΈ (f b).sub_mem hb hrb)
Β· exact hri (add_sub_cancel r s βΈ (f i).sub_mem hi hsi)
Β· rw [Set.mem_iUnionβ] at ht
rcases ht with β¨j, hjt, hjβ©
simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
exact hs (Or.inr <| Set.mem_biUnion hjt <| add_sub_cancel' r s βΈ (f j).sub_mem hj <| hr j hjt)
#align ideal.subset_union_prime' Ideal.subset_union_prime'
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ΞΉ} {f : ΞΉ β Ideal R} (a b : ΞΉ)
(hp : β i β s, i β a β i β b β IsPrime (f i)) {I : Ideal R} :
((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i β s, I β€ f i :=
suffices ((I : Set R) β β i β (βs : Set ΞΉ), f i) β β i, i β s β§ I β€ f i by
have aux := fun h => (bex_def.2 <| this h)
simp_rw [exists_prop] at aux
refine β¨aux, fun β¨i, his, hiβ© β¦ Set.Subset.trans hi ?_β©
apply Set.subset_biUnion_of_mem (show i β (βs : Set ΞΉ) from his)
fun h : (I : Set R) β β i β (βs : Set ΞΉ), f i => by
classical
by_cases has : a β s
Β· obtain β¨t, hat, rflβ© : β t, a β t β§ insert a t = s :=
β¨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase hasβ©
by_cases hbt : b β t
Β· obtain β¨u, hbu, rflβ© : β u, b β u β§ insert b u = t :=
β¨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbtβ©
have hp' : β i β u, IsPrime (f i) := by
intro i hiu
refine' hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) _ _ <;>
rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, β
Set.union_assoc, subset_union_prime' hp'] at h
rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
Β· have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f a : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
Β· by_cases hbs : b β s
Β· obtain β¨t, hbt, rflβ© : β t, b β t β§ insert b t = s :=
β¨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbsβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f b : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
rcases s.eq_empty_or_nonempty with hse | hsne
Β· subst hse
rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
have : (I : Set R) β β
:= Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
exact absurd h this
Β· cases' hsne.bex with i his
obtain β¨t, _, rflβ© : β t, i β t β§ insert i t = s :=
β¨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase hisβ©
have hp' : β j β t, IsPrime (f j) := by
intro j hj
refine' hp j (Finset.mem_insert_of_mem hj) _ _ <;> rintro rfl <;>
solve_by_elim only [Finset.mem_insert_of_mem, *]
rw [Finset.coe_insert, Set.biUnion_insert, β Set.union_self (f i : Set R),
subset_union_prime' hp', β or_assoc, or_self_iff] at h
rwa [Finset.exists_mem_insert]
#align ideal.subset_union_prime Ideal.subset_union_prime
section Dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I β£ J β J β€ I
| β¨_, hβ© => h.symm βΈ le_trans mul_le_inf inf_le_left
#align ideal.le_of_dvd Ideal.le_of_dvd
theorem isUnit_iff {I : Ideal R} : IsUnit I β I = β€ :=
isUnit_iff_dvd_one.trans
((@one_eq_top R _).symm βΈ
β¨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => β¨β€, by rw [mul_top, h]β©β©)
#align ideal.is_unit_iff Ideal.isUnit_iff
instance uniqueUnits : Unique (Ideal R)Λ£ where
default := 1
uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
#align ideal.unique_units Ideal.uniqueUnits
end Dvd
end MulAndRadical
section MapAndComap
variable {R : Type u} {S : Type v}
section Semiring
variable {F : Type*} [Semiring R] [Semiring S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/
def map (I : Ideal R) : Ideal S :=
span (f '' I)
#align ideal.map Ideal.map
/-- `I.comap f` is the preimage of `I` under `f`. -/
def comap (I : Ideal S) : Ideal R where
carrier := f β»ΒΉ' I
add_mem' {x y} hx hy := by
simp only [Set.mem_preimage, SetLike.mem_coe, map_add] at hx hy β’
exact add_mem hx hy
zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem]
smul_mem' c x hx := by
simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at *
exact mul_mem_left I _ hx
#align ideal.comap Ideal.comap
-- Porting note: new theorem
-- @[simp] -- Porting note: TODO enable simp after the port
theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f β»ΒΉ' I := rfl
variable {f}
theorem map_mono (h : I β€ J) : map f I β€ map f J :=
span_mono <| Set.image_subset _ h
#align ideal.map_mono Ideal.map_mono
theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x β I) : f x β map f I :=
subset_span β¨x, h, rflβ©
#align ideal.mem_map_of_mem Ideal.mem_map_of_mem
theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x β I.map f :=
mem_map_of_mem f x.2
#align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map
theorem map_le_iff_le_comap : map f I β€ K β I β€ comap f K :=
span_le.trans Set.image_subset_iff
#align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap
@[simp]
theorem mem_comap {x} : x β comap f K β f x β K :=
Iff.rfl
#align ideal.mem_comap Ideal.mem_comap
theorem comap_mono (h : K β€ L) : comap f K β€ comap f L :=
Set.preimage_mono fun _ hx => h hx
#align ideal.comap_mono Ideal.comap_mono
variable (f)
theorem comap_ne_top (hK : K β β€) : comap f K β β€ :=
(ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK
#align ideal.comap_ne_top Ideal.comap_ne_top
variable {G : Type*} [rcg : RingHomClass G S R]
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) :
I.map f β€ I.comap g := by
refine' Ideal.span_le.2 _
rintro x β¨x, hx, rflβ©
rw [SetLike.mem_coe, mem_comap, hf hx]
exact hx
#align ideal.map_le_comap_of_inv_on Ideal.map_le_comap_of_inv_on
theorem comap_le_map_of_inv_on (g : G) (I : Ideal S) (hf : Set.LeftInvOn g f (f β»ΒΉ' I)) :
I.comap f β€ I.map g := fun x (hx : f x β I) => hf hx βΈ Ideal.mem_map_of_mem g hx
#align ideal.comap_le_map_of_inv_on Ideal.comap_le_map_of_inv_on
/-- The `Ideal` version of `Set.image_subset_preimage_of_inverse`. -/
theorem map_le_comap_of_inverse (g : G) (I : Ideal R) (h : Function.LeftInverse g f) :
I.map f β€ I.comap g :=
map_le_comap_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.map_le_comap_of_inverse Ideal.map_le_comap_of_inverse
/-- The `Ideal` version of `Set.preimage_subset_image_of_inverse`. -/
theorem comap_le_map_of_inverse (g : G) (I : Ideal S) (h : Function.LeftInverse g f) :
I.comap f β€ I.map g :=
comap_le_map_of_inv_on _ _ _ <| h.leftInvOn _
#align ideal.comap_le_map_of_inverse Ideal.comap_le_map_of_inverse
instance IsPrime.comap [hK : K.IsPrime] : (comap f K).IsPrime :=
β¨comap_ne_top _ hK.1, fun {x y} => by simp only [mem_comap, map_mul]; apply hK.2β©
#align ideal.is_prime.comap Ideal.IsPrime.comap
variable (I J K L)
theorem map_top : map f β€ = β€ :=
(eq_top_iff_one _).2 <| subset_span β¨1, trivial, map_one fβ©
#align ideal.map_top Ideal.map_top
theorem gc_map_comap : GaloisConnection (Ideal.map f) (Ideal.comap f) := fun _ _ =>
Ideal.map_le_iff_le_comap
#align ideal.gc_map_comap Ideal.gc_map_comap
@[simp]
theorem comap_id : I.comap (RingHom.id R) = I :=
Ideal.ext fun _ => Iff.rfl
#align ideal.comap_id Ideal.comap_id
@[simp]
theorem map_id : I.map (RingHom.id R) = I :=
(gc_map_comap (RingHom.id R)).l_unique GaloisConnection.id comap_id
#align ideal.map_id Ideal.map_id
theorem comap_comap {T : Type*} [Semiring T] {I : Ideal T} (f : R β+* S) (g : S β+* T) :
(I.comap g).comap f = I.comap (g.comp f) :=
rfl
#align ideal.comap_comap Ideal.comap_comap
theorem map_map {T : Type*} [Semiring T] {I : Ideal R} (f : R β+* S) (g : S β+* T) :
(I.map f).map g = I.map (g.comp f) :=
((gc_map_comap f).compose (gc_map_comap g)).l_unique (gc_map_comap (g.comp f)) fun _ =>
comap_comap _ _
#align ideal.map_map Ideal.map_map
theorem map_span (f : F) (s : Set R) : map f (span s) = span (f '' s) := by
refine (Submodule.span_eq_of_le _ ?_ ?_).symm
Β· rintro _ β¨x, hx, rflβ©; exact mem_map_of_mem f (subset_span hx)
Β· rw [map_le_iff_le_comap, span_le, coe_comap, β Set.image_subset_iff]
exact subset_span
#align ideal.map_span Ideal.map_span
variable {f I J K L}
theorem map_le_of_le_comap : I β€ K.comap f β I.map f β€ K :=
(gc_map_comap f).l_le
#align ideal.map_le_of_le_comap Ideal.map_le_of_le_comap
theorem le_comap_of_map_le : I.map f β€ K β I β€ K.comap f :=
(gc_map_comap f).le_u
#align ideal.le_comap_of_map_le Ideal.le_comap_of_map_le
theorem le_comap_map : I β€ (I.map f).comap f :=
(gc_map_comap f).le_u_l _
#align ideal.le_comap_map Ideal.le_comap_map
theorem map_comap_le : (K.comap f).map f β€ K :=
(gc_map_comap f).l_u_le _
#align ideal.map_comap_le Ideal.map_comap_le
@[simp]
theorem comap_top : (β€ : Ideal S).comap f = β€ :=
(gc_map_comap f).u_top
#align ideal.comap_top Ideal.comap_top
@[simp]
theorem comap_eq_top_iff {I : Ideal S} : I.comap f = β€ β I = β€ :=
β¨fun h => I.eq_top_iff_one.mpr (map_one f βΈ mem_comap.mp ((I.comap f).eq_top_iff_one.mp h)),
fun h => by rw [h, comap_top]β©
#align ideal.comap_eq_top_iff Ideal.comap_eq_top_iff
@[simp]
theorem map_bot : (β₯ : Ideal R).map f = β₯ :=
(gc_map_comap f).l_bot
#align ideal.map_bot Ideal.map_bot
variable (f I J K L)
@[simp]
theorem map_comap_map : ((I.map f).comap f).map f = I.map f :=
(gc_map_comap f).l_u_l_eq_l I
#align ideal.map_comap_map Ideal.map_comap_map
@[simp]
theorem comap_map_comap : ((K.comap f).map f).comap f = K.comap f :=
(gc_map_comap f).u_l_u_eq_u K
#align ideal.comap_map_comap Ideal.comap_map_comap
theorem map_sup : (I β J).map f = I.map f β J.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align ideal.map_sup Ideal.map_sup
theorem comap_inf : comap f (K β L) = comap f K β comap f L :=
rfl
#align ideal.comap_inf Ideal.comap_inf
variable {ΞΉ : Sort*}
theorem map_iSup (K : ΞΉ β Ideal R) : (iSup K).map f = β¨ i, (K i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align ideal.map_supr Ideal.map_iSup
theorem comap_iInf (K : ΞΉ β Ideal S) : (iInf K).comap f = β¨
i, (K i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align ideal.comap_infi Ideal.comap_iInf
theorem map_sSup (s : Set (Ideal R)) : (sSup s).map f = β¨ I β s, (I : Ideal R).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sSup
#align ideal.map_Sup Ideal.map_sSup
theorem comap_sInf (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β s, (I : Ideal S).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_sInf
#align ideal.comap_Inf Ideal.comap_sInf
theorem comap_sInf' (s : Set (Ideal S)) : (sInf s).comap f = β¨
I β comap f '' s, I :=
_root_.trans (comap_sInf f s) (by rw [iInf_image])
#align ideal.comap_Inf' Ideal.comap_sInf'
theorem comap_isPrime [H : IsPrime K] : IsPrime (comap f K) :=
β¨comap_ne_top f H.ne_top, fun {x y} h => H.mem_or_mem <| by rwa [mem_comap, map_mul] at hβ©
#align ideal.comap_is_prime Ideal.comap_isPrime
variable {I J K L}
theorem map_inf_le : map f (I β J) β€ map f I β map f J :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_l.map_inf_le _ _
#align ideal.map_inf_le Ideal.map_inf_le
theorem le_comap_sup : comap f K β comap f L β€ comap f (K β L) :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).monotone_u.le_map_sup _ _
#align ideal.le_comap_sup Ideal.le_comap_sup
@[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]
exact Submodule.add_mem _ hx hy
#align ideal.smul_top_eq_map Ideal.smul_top_eq_map
@[simp]
theorem coe_restrictScalars {R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]
(I : Ideal S) : (I.restrictScalars R : Set S) = βI :=
rfl
#align ideal.coe_restrict_scalars Ideal.coe_restrictScalars
/-- The smallest `S`-submodule that contains all `x β I * y β J`
is also the smallest `R`-submodule that does so. -/
@[simp]
theorem restrictScalars_mul {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
(I J : Ideal S) : (I * J).restrictScalars R = I.restrictScalars R * J.restrictScalars R :=
le_antisymm
(fun _ hx =>
Submodule.mul_induction_on hx (fun _ hx _ hy => Submodule.mul_mem_mul hx hy) fun _ _ =>
Submodule.add_mem _)
(Submodule.mul_le.mpr fun _ hx _ hy => Ideal.mul_mem_mul hx hy)
#align ideal.restrict_scalars_mul Ideal.restrictScalars_mul
section Surjective
variable (hf : Function.Surjective f)
open Function
theorem map_comap_of_surjective (I : Ideal S) : map f (comap f I) = I :=
le_antisymm (map_le_iff_le_comap.2 le_rfl) fun s hsi =>
let β¨r, hfrsβ© := hf s
hfrs βΈ (mem_map_of_mem f <| show f r β I from hfrs.symm βΈ hsi)
#align ideal.map_comap_of_surjective Ideal.map_comap_of_surjective
/-- `map` and `comap` are adjoint, and the composition `map f β comap f` is the
identity -/
def giMapComap : GaloisInsertion (map f) (comap f) :=
GaloisInsertion.monotoneIntro (gc_map_comap f).monotone_u (gc_map_comap f).monotone_l
(fun _ => le_comap_map) (map_comap_of_surjective _ hf)
#align ideal.gi_map_comap Ideal.giMapComap
theorem map_surjective_of_surjective : Surjective (map f) :=
(giMapComap f hf).l_surjective
#align ideal.map_surjective_of_surjective Ideal.map_surjective_of_surjective
theorem comap_injective_of_surjective : Injective (comap f) :=
(giMapComap f hf).u_injective
#align ideal.comap_injective_of_surjective Ideal.comap_injective_of_surjective
theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_sup_u _ _
#align ideal.map_sup_comap_of_surjective Ideal.map_sup_comap_of_surjective
theorem map_iSup_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨ i, (K i).comap f).map f = iSup K :=
(giMapComap f hf).l_iSup_u _
#align ideal.map_supr_comap_of_surjective Ideal.map_iSup_comap_of_surjective
theorem map_inf_comap_of_surjective (I J : Ideal S) : (I.comap f β J.comap f).map f = I β J :=
(giMapComap f hf).l_inf_u _ _
#align ideal.map_inf_comap_of_surjective Ideal.map_inf_comap_of_surjective
theorem map_iInf_comap_of_surjective (K : ΞΉ β Ideal S) : (β¨
i, (K i).comap f).map f = iInf K :=
(giMapComap f hf).l_iInf_u _
#align ideal.map_infi_comap_of_surjective Ideal.map_iInf_comap_of_surjective
theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y β map f I) : y β f '' I :=
Submodule.span_induction H (fun _ => id) β¨0, I.zero_mem, map_zero fβ©
(fun _ _ β¨x1, hx1i, hxy1β© β¨x2, hx2i, hxy2β© =>
β¨x1 + x2, I.add_mem hx1i hx2i, hxy1 βΈ hxy2 βΈ map_add f _ _β©)
fun c _ β¨x, hxi, hxyβ© =>
let β¨d, hdcβ© := hf c
β¨d * x, I.mul_mem_left _ hxi, hdc βΈ hxy βΈ map_mul f _ _β©
#align ideal.mem_image_of_mem_map_of_surjective Ideal.mem_image_of_mem_map_of_surjective
theorem mem_map_iff_of_surjective {I : Ideal R} {y} : y β map f I β β x, x β I β§ f x = y :=
β¨fun h => (Set.mem_image _ _ _).2 (mem_image_of_mem_map_of_surjective f hf h), fun β¨_, hxβ© =>
hx.right βΈ mem_map_of_mem f hx.leftβ©
#align ideal.mem_map_iff_of_surjective Ideal.mem_map_iff_of_surjective
theorem le_map_of_comap_le_of_surjective : comap f K β€ I β K β€ map f I := fun h =>
map_comap_of_surjective f hf K βΈ map_mono h
#align ideal.le_map_of_comap_le_of_surjective Ideal.le_map_of_comap_le_of_surjective
theorem map_eq_submodule_map (f : R β+* S) [h : RingHomSurjective f] (I : Ideal R) :
I.map f = Submodule.map f.toSemilinearMap I :=
Submodule.ext fun _ => mem_map_iff_of_surjective f h.1
#align ideal.map_eq_submodule_map Ideal.map_eq_submodule_map
end Surjective
section Injective
variable (hf : Function.Injective f)
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
exact Eq.symm (hf hx) βΈ Submodule.zero_mem β₯
#align ideal.comap_bot_le_of_injective Ideal.comap_bot_le_of_injective
theorem comap_bot_of_injective : Ideal.comap f β₯ = β₯ :=
le_bot_iff.mp (Ideal.comap_bot_le_of_injective f hf)
#align ideal.comap_bot_of_injective Ideal.comap_bot_of_injective
end Injective
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, map_map,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
#align ideal.map_of_equiv Ideal.map_of_equiv
/-- 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
rw [β RingEquiv.toRingHom_eq_coe, β RingEquiv.toRingHom_eq_coe, comap_comap,
RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
#align ideal.comap_of_equiv Ideal.comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f I = comap f.symm I`. -/
theorem map_comap_of_equiv (I : Ideal R) (f : R β+* S) : I.map (f : R β+* S) = I.comap f.symm :=
le_antisymm (Ideal.map_le_comap_of_inverse _ _ _ (Equiv.left_inv' _))
(Ideal.comap_le_map_of_inverse _ _ _ (Equiv.right_inv' _))
#align ideal.map_comap_of_equiv Ideal.map_comap_of_equiv
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `comap f.symm I = map f I`. -/
@[simp]
theorem comap_symm (I : Ideal R) (f : R β+* S) : I.comap f.symm = I.map f :=
(map_comap_of_equiv I f).symm
/-- If `f : R β+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm I = comap f I`. -/
@[simp]
theorem map_symm (I : Ideal S) (f : R β+* S) : I.map f.symm = I.comap f :=
map_comap_of_equiv I (RingEquiv.symm f)
end Semiring
section Ring
variable {F : Type*} [Ring R] [Ring S]
variable [RingHomClass F R S] (f : F) {I : Ideal R}
section Surjective
variable (hf : Function.Surjective f)
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 rw [map_sub, hfsr, sub_self],
add_sub_cancel'_right s rβ©)
(sup_le (map_le_iff_le_comap.1 le_rfl) (comap_mono bot_le))
#align ideal.comap_map_of_surjective Ideal.comap_map_of_surjective
/-- Correspondence theorem -/
def relIsoOfSurjective : Ideal S βo { p : Ideal R // comap f β₯ β€ p } where
toFun J := β¨comap f J, comap_mono bot_leβ©
invFun I := map f I.1
left_inv J := map_comap_of_surjective f hf J
right_inv I :=
Subtype.eq <|
show comap f (map f I.1) = I.1 from
(comap_map_of_surjective f hf I).symm βΈ le_antisymm (sup_le le_rfl I.2) le_sup_left
map_rel_iff' {I1 I2} :=
β¨fun H => map_comap_of_surjective f hf I1 βΈ map_comap_of_surjective f hf I2 βΈ map_mono H,
comap_monoβ©
#align ideal.rel_iso_of_surjective Ideal.relIsoOfSurjective
/-- The map on ideals induced by a surjective map preserves inclusion. -/
def orderEmbeddingOfSurjective : Ideal S βͺo Ideal R :=
(relIsoOfSurjective f hf).toRelEmbedding.trans (Subtype.relEmbedding (fun x y => x β€ y) _)
#align ideal.order_embedding_of_surjective Ideal.orderEmbeddingOfSurjective
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)
Β· exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
#align ideal.map_eq_top_or_is_maximal_of_surjective Ideal.map_eq_top_or_isMaximal_of_surjective
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]
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
#align ideal.comap_is_maximal_of_surjective Ideal.comap_isMaximal_of_surjective
theorem comap_le_comap_iff_of_surjective (I J : Ideal S) : comap f I β€ comap f J β I β€ J :=
β¨fun h => (map_comap_of_surjective f hf I).symm.le.trans (map_le_of_le_comap h), fun h =>
le_comap_of_map_le ((map_comap_of_surjective f hf I).le.trans h)β©
#align ideal.comap_le_comap_iff_of_surjective Ideal.comap_le_comap_iff_of_surjective
end Surjective
section Bijective
variable (hf : Function.Bijective f)
/-- Special case of the correspondence theorem for isomorphic rings -/
def relIsoOfBijective : Ideal S βo Ideal R where
toFun := comap f
invFun := map f
left_inv := (relIsoOfSurjective f hf.right).left_inv
right_inv J :=
Subtype.ext_iff.1
((relIsoOfSurjective f hf.right).right_inv β¨J, comap_bot_le_of_injective f hf.leftβ©)
map_rel_iff' {_ _} := (relIsoOfSurjective f hf.right).map_rel_iff'
#align ideal.rel_iso_of_bijective Ideal.relIsoOfBijective
theorem comap_le_iff_le_map {I : Ideal R} {K : Ideal S} : comap f K β€ I β K β€ map f I :=
β¨fun h => le_map_of_comap_le_of_surjective f hf.right h, fun h =>
(relIsoOfBijective f hf).right_inv I βΈ comap_mono hβ©
#align ideal.comap_le_iff_le_map Ideal.comap_le_iff_le_map
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 _
calc
I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
_ = comap f β€ := by rw [h]
_ = β€ := by rw [comap_top]
#align ideal.map.is_maximal Ideal.map.isMaximal
end Bijective
theorem RingEquiv.bot_maximal_iff (e : R β+* S) :
(β₯ : Ideal R).IsMaximal β (β₯ : Ideal S).IsMaximal :=
β¨fun h => @map_bot _ _ _ _ _ _ e.toRingHom βΈ map.isMaximal e.toRingHom e.bijective h, fun h =>
@map_bot _ _ _ _ _ _ e.symm.toRingHom βΈ map.isMaximal e.symm.toRingHom e.symm.bijective hβ©
#align ideal.ring_equiv.bot_maximal_iff Ideal.RingEquiv.bot_maximal_iff
end Ring
section CommRing
variable {F : Type*} [CommRing R] [CommRing S]
variable [rc : RingHomClass F R S]
variable (f : F)
variable {I J : Ideal R} {K L : Ideal S}
variable (I J K L)
theorem map_mul : map f (I * J) = map f I * map f J :=
le_antisymm
(map_le_iff_le_comap.2 <|
mul_le.2 fun r hri s hsj =>
show (f (r * s)) β map f I * map f J by
rw [_root_.map_mul]; exact mul_mem_mul (mem_map_of_mem f hri) (mem_map_of_mem f hsj))
(span_mul_span (βf '' βI) (βf '' βJ) βΈ (span_le.2 <|
Set.iUnionβ_subset fun i β¨r, hri, hfriβ© =>
Set.iUnionβ_subset fun j β¨s, hsj, hfsjβ© =>
Set.singleton_subset_iff.2 <|
hfri βΈ hfsj βΈ by rw [β _root_.map_mul]; exact mem_map_of_mem f (mul_mem_mul hri hsj)))
#align ideal.map_mul Ideal.map_mul
/-- The pushforward `Ideal.map` as a monoid-with-zero homomorphism. -/
@[simps]
def mapHom : Ideal R β*β Ideal S where
toFun := map f
map_mul' I J := Ideal.map_mul f I J
map_one' := by simp only [one_eq_top]; exact Ideal.map_top f
map_zero' := Ideal.map_bot
#align ideal.map_hom Ideal.mapHom
protected theorem map_pow (n : β) : map f (I ^ n) = map f I ^ n :=
map_pow (mapHom f) I n
#align ideal.map_pow Ideal.map_pow
theorem comap_radical : comap f (radical K) = radical (comap f K) := by
ext
simp [radical]
#align ideal.comap_radical Ideal.comap_radical
variable {K}
theorem IsRadical.comap (hK : K.IsRadical) : (comap f K).IsRadical := by
rw [β hK.radical, comap_radical]
apply radical_isRadical
#align ideal.is_radical.comap Ideal.IsRadical.comap
variable {I J L}
theorem map_radical_le : map f (radical I) β€ radical (map f I) :=
map_le_iff_le_comap.2 fun r β¨n, hrniβ© => β¨n, map_pow f r n βΈ mem_map_of_mem f hrniβ©
#align ideal.map_radical_le Ideal.map_radical_le
theorem le_comap_mul : comap f K * comap f L β€ comap f (K * L) :=
map_le_iff_le_comap.1 <|
(map_mul f (comap f K) (comap f L)).symm βΈ
mul_mono (map_le_iff_le_comap.2 <| le_rfl) (map_le_iff_le_comap.2 <| le_rfl)
#align ideal.le_comap_mul Ideal.le_comap_mul
theorem le_comap_pow (n : β) : K.comap f ^ n β€ (K ^ n).comap f := by
induction' n with n n_ih
Β· rw [pow_zero, pow_zero, Ideal.one_eq_top, Ideal.one_eq_top]
exact rfl.le
Β· rw [pow_succ, pow_succ]
exact (Ideal.mul_mono_right n_ih).trans (Ideal.le_comap_mul f)
#align ideal.le_comap_pow Ideal.le_comap_pow
end CommRing
end MapAndComap
section IsPrimary
variable {R : Type u} [CommSemiring R]
/-- A proper ideal `I` is primary iff `xy β I` implies `x β I` or `y β radical I`. -/
def IsPrimary (I : Ideal R) : Prop :=
I β β€ β§ β {x y : R}, x * y β I β x β I β¨ y β radical I
#align ideal.is_primary Ideal.IsPrimary
theorem IsPrime.isPrimary {I : Ideal R} (hi : IsPrime I) : IsPrimary I :=
β¨hi.1, fun {_ _} hxy => (hi.mem_or_mem hxy).imp id fun hyi => le_radical hyiβ©
#align ideal.is_prime.is_primary Ideal.IsPrime.isPrimary
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : β} (hx : x ^ m β radical I) :
x β radical I :=
radical_idem I βΈ β¨m, hxβ©
#align ideal.mem_radical_of_pow_mem Ideal.mem_radical_of_pow_mem
theorem isPrime_radical {I : Ideal R} (hi : IsPrimary I) : IsPrime (radical I) :=
β¨mt radical_eq_top.1 hi.1,
fun {x y} β¨m, hxyβ© => by
rw [mul_pow] at hxy; cases' hi.2 hxy with h h
Β· exact Or.inl β¨m, hβ©
Β· exact Or.inr (mem_radical_of_pow_mem h)β©
#align ideal.is_prime_radical Ideal.isPrime_radical
theorem isPrimary_inf {I J : Ideal R} (hi : IsPrimary I) (hj : IsPrimary J)
(hij : radical I = radical J) : IsPrimary (I β J) :=
β¨ne_of_lt <| lt_of_le_of_lt inf_le_left (lt_top_iff_ne_top.2 hi.1),
fun {x y} β¨hxyi, hxyjβ© => by
rw [radical_inf, hij, inf_idem]
cases' hi.2 hxyi with hxi hyi; cases' hj.2 hxyj with hxj hyj
Β· exact Or.inl β¨hxi, hxjβ©
Β· exact Or.inr hyj
Β· rw [hij] at hyi
exact Or.inr hyiβ©
#align ideal.is_primary_inf Ideal.isPrimary_inf
end IsPrimary
section Total
variable (ΞΉ : Type*)
variable (M : Type*) [AddCommGroup M] {R : Type*} [CommRing R] [Module R M] (I : Ideal R)
variable (v : ΞΉ β M) (hv : Submodule.span R (Set.range v) = β€)
open BigOperators
/-- A variant of `Finsupp.total` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ΞΉ ββ I) ββ[R] M :=
(Finsupp.total ΞΉ M R v).comp (Finsupp.mapRange.linearMap I.subtype)
#align ideal.finsupp_total Ideal.finsuppTotal
variable {ΞΉ M v}
theorem finsuppTotal_apply (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = f.sum fun i x => (x : R) β’ v i := by
dsimp [finsuppTotal]
rw [Finsupp.total_apply, Finsupp.sum_mapRange_index]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply Ideal.finsuppTotal_apply
theorem finsuppTotal_apply_eq_of_fintype [Fintype ΞΉ] (f : ΞΉ ββ I) :
finsuppTotal ΞΉ M I v f = β i, (f i : R) β’ v i := by
rw [finsuppTotal_apply, Finsupp.sum_fintype]
exact fun _ => zero_smul _ _
#align ideal.finsupp_total_apply_eq_of_fintype Ideal.finsuppTotal_apply_eq_of_fintype
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)]
Β· exact fun _ => zero_smul _ _
#align ideal.range_finsupp_total Ideal.range_finsuppTotal
end Total
section Basis
variable {ΞΉ R S : Type*} [CommSemiring R] [CommRing S] [IsDomain S] [Algebra R S]
/-- 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
simp [mem_span_singleton', mul_comm]) βͺβ«β
(Submodule.restrictScalarsEquiv R S S (Ideal.span ({x} : Set S))).restrictScalars R
#align ideal.basis_span_singleton Ideal.basisSpanSingleton
@[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
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
LinearMap.mul_apply']
#align ideal.basis_span_singleton_apply Ideal.basisSpanSingleton_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
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
#align ideal.constr_basis_span_singleton Ideal.constr_basisSpanSingleton
end Basis
end Ideal
section span_range
variable {Ξ± R : Type*} [Semiring R]
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± ββ R, (c.sum fun i a => a * v i) = x :=
Finsupp.mem_span_range_iff_exists_finsupp
/-- An element `x` lies in the span of `v` iff it can be written as sum `β cα΅’ β’ vα΅’ = x`.
-/
theorem mem_ideal_span_range_iff_exists_fun [Fintype Ξ±] {x : R} {v : Ξ± β R} :
x β Ideal.span (Set.range v) β β c : Ξ± β R, β i, c i * v i = x :=
mem_span_range_iff_exists_fun _
end span_range
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
Associates.mk (Ideal.span {r} : Ideal R) β 0 β r β 0 := by
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
#align associates.mk_ne_zero' Associates.mk_ne_zero'
-- Porting note: added explicit coercion `(b i : S)`
/-- If `I : Ideal S` has a basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff {ΞΉ R S : Type*} [CommRing R] [CommRing S] [Algebra R S] {I : Ideal S}
(b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ ββ R, x = Finsupp.sum c fun i x => x β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff
#align basis.mem_ideal_iff Basis.mem_ideal_iff
/-- If `I : Ideal S` has a finite basis over `R`,
`x β I` iff it is a linear combination of basis vectors. -/
theorem Basis.mem_ideal_iff' {ΞΉ R S : Type*} [Fintype ΞΉ] [CommRing R] [CommRing S] [Algebra R S]
{I : Ideal S} (b : Basis ΞΉ R I) {x : S} : x β I β β c : ΞΉ β R, x = β i, c i β’ (b i : S) :=
(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff'
#align basis.mem_ideal_iff' Basis.mem_ideal_iff'
namespace RingHom
variable {R : Type u} {S : Type v} {T : Type w}
section Semiring
variable {F : Type*} {G : Type*} [Semiring R] [Semiring S] [Semiring T]
variable [rcf : RingHomClass F R S] [rcg : RingHomClass G T S] (f : F) (g : G)
/-- Kernel of a ring homomorphism as an ideal of the domain. -/
def ker : Ideal R :=
Ideal.comap f β₯
#align ring_hom.ker RingHom.ker
/-- 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 rw [ker, Ideal.mem_comap, Submodule.mem_bot]
#align ring_hom.mem_ker RingHom.mem_ker
theorem ker_eq : (ker f : Set R) = Set.preimage f {0} :=
rfl
#align ring_hom.ker_eq RingHom.ker_eq
theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f β₯ :=
rfl
#align ring_hom.ker_eq_comap_bot RingHom.ker_eq_comap_bot
theorem comap_ker (f : S β+* R) (g : T β+* S) : f.ker.comap g = ker (f.comp g) := by
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
#align ring_hom.comap_ker RingHom.comap_ker
/-- 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]
exact one_ne_zero
#align ring_hom.not_one_mem_ker RingHom.not_one_mem_ker
theorem ker_ne_top [Nontrivial S] (f : F) : ker f β β€ :=
(Ideal.ne_top_iff_one _).mpr <| not_one_mem_ker f
#align ring_hom.ker_ne_top RingHom.ker_ne_top
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
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
end Semiring
section Ring
variable {F : Type*} [Ring R] [Semiring S] [rc : RingHomClass F R S] (f : F)
theorem injective_iff_ker_eq_bot : Function.Injective f β ker f = β₯ := by
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
exact injective_iff_map_eq_zero' f
#align ring_hom.injective_iff_ker_eq_bot RingHom.injective_iff_ker_eq_bot
theorem ker_eq_bot_iff_eq_zero : ker f = β₯ β β x, f x = 0 β x = 0 := by
rw [β injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
#align ring_hom.ker_eq_bot_iff_eq_zero RingHom.ker_eq_bot_iff_eq_zero
@[simp]
theorem ker_coe_equiv (f : R β+* S) : ker (f : R β+* S) = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_coe_equiv RingHom.ker_coe_equiv
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = β₯ := by
simpa only [β injective_iff_ker_eq_bot] using EquivLike.injective f
#align ring_hom.ker_equiv RingHom.ker_equiv
end Ring
section RingRing
variable {F : Type*} [Ring R] [Ring S] [rc : RingHomClass F R S] (f : F)
theorem sub_mem_ker_iff {x y} : x - y β ker f β f x = f y := by rw [mem_ker, map_sub, sub_eq_zero]
#align ring_hom.sub_mem_ker_iff RingHom.sub_mem_ker_iff
@[simp]
theorem ker_rangeRestrict (f : R β+* S) : ker f.rangeRestrict = ker f :=
Ideal.ext fun _ β¦ Subtype.ext_iff
end RingRing
/-- 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
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _β©
#align ring_hom.ker_is_prime RingHom.ker_isPrime
/-- 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]
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
#align ring_hom.ker_is_maximal_of_surjective RingHom.ker_isMaximal_of_surjective
end RingHom
namespace Ideal
variable {R : Type*} {S : Type*} {F : Type*}
section Semiring
variable [Semiring R] [Semiring S] [rc : RingHomClass F R S]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = β₯ β I β€ RingHom.ker f := by
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
#align ideal.map_eq_bot_iff_le_ker Ideal.map_eq_bot_iff_le_ker
theorem ker_le_comap {K : Ideal S} (f : F) : RingHom.ker f β€ comap f K := fun _ hx =>
mem_comap.2 (((RingHom.mem_ker f).1 hx).symm βΈ K.zero_mem)
#align ideal.ker_le_comap Ideal.ker_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
have h : I.map f = I.map ((f : R β+* S) : R β+* S) := rfl
rw [h, map_comap_of_equiv I (f : R β+* S)]
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R β+* S))
#align ideal.map_is_prime_of_equiv Ideal.map_isPrime_of_equiv
end Semiring
section Ring
variable [Ring R] [Ring S] [rc : RingHomClass 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
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
refine' hx βΈ mem_map_of_mem f _
have : β I β A, y β map f I := by simpa using hy
rw [Submodule.mem_sInf]
intro J hJ
rcases (mem_map_iff_of_surjective f hf).1 (this J hJ) with β¨x', hx', rflβ©
have : x - x' β J := by
apply h J hJ
rw [RingHom.mem_ker, map_sub, hx, sub_self]
simpa only [sub_add_cancel] using J.add_mem this hx'
#align ideal.map_Inf Ideal.map_sInf
theorem map_isPrime_of_surjective {f : F} (hf : Function.Surjective f) {I : Ideal R} [H : IsPrime I]
(hk : RingHom.ker f β€ I) : IsPrime (map f I) := by
refine' β¨fun h => H.ne_top (eq_top_iff.2 _), fun {x y} => _β©
Β· replace h := congr_arg (comap f) h
rw [comap_map_of_surjective _ hf, comap_top] at h
exact h βΈ sup_le (le_of_eq rfl) hk
Β· refine' fun hxy => (hf x).recOn fun a ha => (hf y).recOn fun b hb => _
rw [β ha, β hb, β _root_.map_mul f, mem_map_iff_of_surjective _ hf] at hxy
rcases hxy with β¨c, hc, hc'β©
rw [β sub_eq_zero, β map_sub] at hc'
have : a * b β I := by
convert I.sub_mem hc (hk (hc' : c - a * b β RingHom.ker f)) using 1
abel
exact
(H.mem_or_mem this).imp (fun h => ha βΈ mem_map_of_mem f h) fun h => hb βΈ mem_map_of_mem f h
#align ideal.map_is_prime_of_surjective Ideal.map_isPrime_of_surjective
theorem map_eq_bot_iff_of_injective {I : Ideal R} {f : F} (hf : Function.Injective f) :
I.map f = β₯ β I = β₯ := by
rw [map_eq_bot_iff_le_ker, (RingHom.injective_iff_ker_eq_bot f).mp hf, le_bot_iff]
#align ideal.map_eq_bot_iff_of_injective Ideal.map_eq_bot_iff_of_injective
end Ring
section CommRing
variable [CommRing R] [CommRing S]
theorem map_eq_iff_sup_ker_eq_of_surjective {I J : Ideal R} (f : R β+* S)
(hf : Function.Surjective f) : map f I = map f J β I β RingHom.ker f = J β RingHom.ker f := by
rw [β (comap_injective_of_surjective f hf).eq_iff, comap_map_of_surjective f hf,
comap_map_of_surjective f hf, RingHom.ker_eq_comap_bot]
#align ideal.map_eq_iff_sup_ker_eq_of_surjective Ideal.map_eq_iff_sup_ker_eq_of_surjective
theorem map_radical_of_surjective {f : R β+* S} (hf : Function.Surjective f) {I : Ideal R}
(h : RingHom.ker f β€ I) : map f I.radical = (map f I).radical := by
rw [radical_eq_sInf, radical_eq_sInf]
have : β J β {J : Ideal R | I β€ J β§ J.IsPrime}, RingHom.ker f β€ J := fun J hJ => h.trans hJ.left
convert map_sInf hf this
refine' funext fun j => propext β¨_, _β©
Β· rintro β¨hj, hj'β©
haveI : j.IsPrime := hj'
exact
β¨comap f j, β¨β¨map_le_iff_le_comap.1 hj, comap_isPrime f jβ©, map_comap_of_surjective f hf jβ©β©
Β· rintro β¨J, β¨hJ, hJ'β©β©
haveI : J.IsPrime := hJ.right
refine' β¨hJ' βΈ map_mono hJ.left, hJ' βΈ map_isPrime_of_surjective hf (le_trans h hJ.left)β©
#align ideal.map_radical_of_surjective Ideal.map_radical_of_surjective
end CommRing
end Ideal
namespace Submodule
variable {R : Type u} {M : Type v}
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
-- TODO: show `[Algebra R A] : Algebra (Ideal R) A` too
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
smul_add := smul_sup
add_smul := sup_smul
mul_smul := Submodule.smul_assoc
one_smul := by simp
zero_smul := bot_smul
smul_zero := smul_bot
#align submodule.module_submodule Submodule.moduleSubmodule
end Submodule
namespace RingHom
variable {A B C : Type*} [Ring A] [Ring B] [Ring C]
variable (f : A β+* B) (f_inv : B β A)
/-- Auxiliary definition used to define `liftOfRightInverse` -/
def liftOfRightInverseAux (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) :
B β+* C :=
{ AddMonoidHom.liftOfRightInverse f.toAddMonoidHom f_inv hf β¨g.toAddMonoidHom, hgβ© with
toFun := fun b => g (f_inv b)
map_one' := by
rw [β map_one g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_one f]
exact hf 1
map_mul' := by
intro x y
rw [β map_mul g, β sub_eq_zero, β map_sub g, β mem_ker g]
apply hg
rw [mem_ker f, map_sub f, sub_eq_zero, map_mul f]
simp only [hf _] }
#align ring_hom.lift_of_right_inverse_aux RingHom.liftOfRightInverseAux
@[simp]
theorem liftOfRightInverseAux_comp_apply (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) (a : A) :
(f.liftOfRightInverseAux f_inv hf g hg) (f a) = g a :=
f.toAddMonoidHom.liftOfRightInverse_comp_apply f_inv hf β¨g.toAddMonoidHom, hgβ© a
#align ring_hom.lift_of_right_inverse_aux_comp_apply RingHom.liftOfRightInverseAux_comp_apply
/-- `liftOfRightInverse f hf g hg` is the unique ring homomorphism `Ο`
* such that `Ο.comp f = g` (`RingHom.liftOfRightInverse_comp`),
* where `f : A β+* B` has a right_inverse `f_inv` (`hf`),
* and `g : B β+* C` satisfies `hg : f.ker β€ g.ker`.
See `RingHom.eq_liftOfRightInverse` for the uniqueness lemma.
```
A .
| \
f | \ g
| \
v \β
B ----> C
β!Ο
```
-/
def liftOfRightInverse (hf : Function.RightInverse f_inv f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) where
toFun g := f.liftOfRightInverseAux f_inv hf g.1 g.2
invFun Ο := β¨Ο.comp f, fun x hx => (mem_ker _).mpr <| by simp [(mem_ker _).mp hx]β©
left_inv g := by
ext
simp only [comp_apply, liftOfRightInverseAux_comp_apply, Subtype.coe_mk]
right_inv Ο := by
ext b
simp [liftOfRightInverseAux, hf b]
#align ring_hom.lift_of_right_inverse RingHom.liftOfRightInverse
/-- A non-computable version of `RingHom.liftOfRightInverse` for when no computable right
inverse is available, that uses `Function.surjInv`. -/
@[simp]
noncomputable abbrev liftOfSurjective (hf : Function.Surjective f) :
{ g : A β+* C // RingHom.ker f β€ RingHom.ker g } β (B β+* C) :=
f.liftOfRightInverse (Function.surjInv hf) (Function.rightInverse_surjInv hf)
#align ring_hom.lift_of_surjective RingHom.liftOfSurjective
theorem liftOfRightInverse_comp_apply (hf : Function.RightInverse f_inv f)
(g : { g : A β+* C // RingHom.ker f β€ RingHom.ker g }) (x : A) :
(f.liftOfRightInverse f_inv hf g) (f x) = g.1 x :=
f.liftOfRightInverseAux_comp_apply f_inv hf g.1 g.2 x
#align ring_hom.lift_of_right_inverse_comp_apply RingHom.liftOfRightInverse_comp_apply
theorem liftOfRightInverse_comp (hf : Function.RightInverse f_inv f)
(g : { g : A β+* C // RingHom.ker f β€ RingHom.ker g }) :
(f.liftOfRightInverse f_inv hf g).comp f = g :=
RingHom.ext <| f.liftOfRightInverse_comp_apply f_inv hf g
#align ring_hom.lift_of_right_inverse_comp RingHom.liftOfRightInverse_comp
theorem eq_liftOfRightInverse (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) (h : B β+* C) (hh : h.comp f = g) :
h = f.liftOfRightInverse f_inv hf β¨g, hgβ© := by
simp_rw [β hh]
| exact ((f.liftOfRightInverse f_inv hf).apply_symm_apply _).symm | theorem eq_liftOfRightInverse (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) (h : B β+* C) (hh : h.comp f = g) :
h = f.liftOfRightInverse f_inv hf β¨g, hgβ© := by
simp_rw [β hh]
| Mathlib.RingTheory.Ideal.Operations.2369_0.5qK551sG47yBciY | theorem eq_liftOfRightInverse (hf : Function.RightInverse f_inv f) (g : A β+* C)
(hg : RingHom.ker f β€ RingHom.ker g) (h : B β+* C) (hh : h.comp f = g) :
h = f.liftOfRightInverse f_inv hf β¨g, hgβ© | Mathlib_RingTheory_Ideal_Operations |
x : β
n_large : 512 β€ x
β’ x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
| let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
β’ x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
| have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _) | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
β’ x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
| have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x] | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
β’ β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
| intro x h5 | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
xβ : β
n_large : 512 β€ xβ
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
x : β
h5 : 0 < x
β’ f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
| have h6 := mul_pos (zero_lt_two' β) h5 | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
xβ : β
n_large : 512 β€ xβ
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
x : β
h5 : 0 < x
h6 : 0 < 2 * x
β’ f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
| have h7 := rpow_pos_of_pos h6 (sqrt (2 * x)) | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
xβ : β
n_large : 512 β€ xβ
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
x : β
h5 : 0 < x
h6 : 0 < 2 * x
h7 : 0 < (2 * x) ^ sqrt (2 * x)
β’ f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
| rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x] | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
β’ x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
| have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
β’ 0 < 512 | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by | norm_num1 | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by | Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
| rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5] | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ 1 - 2 / 3 = 1 / 3 | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by | norm_num1 | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by | Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ f x β€ 0 | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
| have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· ext x
simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply,
LinearMap.id_coe, id_eq, smul_eq_mul]
rw [β mul_lt_mul_left (two_pos)]
norm_num1
rfl
apply ConvexOn.smul
refine div_nonneg (log_nonneg (by norm_num1)) (by norm_num1)
exact convexOn_id (convex_Ioi (0.5 : β)) | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ ConcaveOn β (Set.Ioi 0.5) f | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
| apply ConcaveOn.sub | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
case hf
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ ConcaveOn β (Set.Ioi 0.5) fun x => log x + sqrt (2 * x) * log (2 * x)
case hg
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ ConvexOn β (Set.Ioi 0.5) fun x => log 4 / 3 * x | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
| apply ConcaveOn.add | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
case hf.hf
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ ConcaveOn β (Set.Ioi 0.5) fun x => log x
case hf.hg
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ ConcaveOn β (Set.Ioi 0.5) fun x => sqrt (2 * x) * log (2 * x)
case hg
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ ConvexOn β (Set.Ioi 0.5) fun x => log 4 / 3 * x | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
| exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5) | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ 0 β€ 0.5 | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by | norm_num | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by | Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
case hf.hg
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ ConcaveOn β (Set.Ioi 0.5) fun x => sqrt (2 * x) * log (2 * x)
case hg
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ ConvexOn β (Set.Ioi 0.5) fun x => log 4 / 3 * x | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
| convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1 | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
case h.e'_9
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ Set.Ioi 0.5 = β(2 β’ LinearMap.id) β»ΒΉ' Set.Ioi 1 | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· | ext x | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· | Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
case h.e'_9.h
xβ : β
n_large : 512 β€ xβ
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < xβ
x : β
β’ x β Set.Ioi 0.5 β x β β(2 β’ LinearMap.id) β»ΒΉ' Set.Ioi 1 | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· ext x
| simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply,
LinearMap.id_coe, id_eq, smul_eq_mul] | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· ext x
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
case h.e'_9.h
xβ : β
n_large : 512 β€ xβ
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < xβ
x : β
β’ OfScientific.ofScientific 5 true 1 < x β 1 < 2 * x | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· ext x
simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply,
LinearMap.id_coe, id_eq, smul_eq_mul]
| rw [β mul_lt_mul_left (two_pos)] | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· ext x
simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply,
LinearMap.id_coe, id_eq, smul_eq_mul]
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
case h.e'_9.h
xβ : β
n_large : 512 β€ xβ
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < xβ
x : β
β’ 2 * OfScientific.ofScientific 5 true 1 < 2 * x β 1 < 2 * x | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· ext x
simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply,
LinearMap.id_coe, id_eq, smul_eq_mul]
rw [β mul_lt_mul_left (two_pos)]
| norm_num1 | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· ext x
simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply,
LinearMap.id_coe, id_eq, smul_eq_mul]
rw [β mul_lt_mul_left (two_pos)]
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
case h.e'_9.h
xβ : β
n_large : 512 β€ xβ
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < xβ
x : β
β’ 1 < 2 * x β 1 < 2 * x | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· ext x
simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply,
LinearMap.id_coe, id_eq, smul_eq_mul]
rw [β mul_lt_mul_left (two_pos)]
norm_num1
| rfl | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· ext x
simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply,
LinearMap.id_coe, id_eq, smul_eq_mul]
rw [β mul_lt_mul_left (two_pos)]
norm_num1
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
case hg
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ ConvexOn β (Set.Ioi 0.5) fun x => log 4 / 3 * x | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· ext x
simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply,
LinearMap.id_coe, id_eq, smul_eq_mul]
rw [β mul_lt_mul_left (two_pos)]
norm_num1
rfl
| apply ConvexOn.smul | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· ext x
simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply,
LinearMap.id_coe, id_eq, smul_eq_mul]
rw [β mul_lt_mul_left (two_pos)]
norm_num1
rfl
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
case hg.hc
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ 0 β€ log 4 / 3
case hg.hf
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ ConvexOn β (Set.Ioi 0.5) fun x => x | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· ext x
simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply,
LinearMap.id_coe, id_eq, smul_eq_mul]
rw [β mul_lt_mul_left (two_pos)]
norm_num1
rfl
apply ConvexOn.smul
| refine div_nonneg (log_nonneg (by norm_num1)) (by norm_num1) | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· ext x
simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply,
LinearMap.id_coe, id_eq, smul_eq_mul]
rw [β mul_lt_mul_left (two_pos)]
norm_num1
rfl
apply ConvexOn.smul
| Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ 1 β€ 4 | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· ext x
simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply,
LinearMap.id_coe, id_eq, smul_eq_mul]
rw [β mul_lt_mul_left (two_pos)]
norm_num1
rfl
apply ConvexOn.smul
refine div_nonneg (log_nonneg (by | norm_num1 | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· ext x
simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply,
LinearMap.id_coe, id_eq, smul_eq_mul]
rw [β mul_lt_mul_left (two_pos)]
norm_num1
rfl
apply ConvexOn.smul
refine div_nonneg (log_nonneg (by | Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |
x : β
n_large : 512 β€ x
f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
hf' : β (x : β), 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)
hf : β (x : β), 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3))
h5 : 0 < x
β’ 0 β€ 3 | /-
Copyright (c) 2020 Patrick Stevens. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Stevens, Bolton Bailey
-/
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.Data.Nat.PrimeNormNum
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
/-!
# Bertrand's Postulate
This file contains a proof of Bertrand's postulate: That between any positive number and its
double there is a prime.
The proof follows the outline of the ErdΕs proof presented in "Proofs from THE BOOK": One considers
the prime factorization of `(2 * n).choose n`, and splits the constituent primes up into various
groups, then upper bounds the contribution of each group. This upper bounds the central binomial
coefficient, and if the postulate does not hold, this upper bound conflicts with a simple lower
bound for large enough `n`. This proves the result holds for large enough `n`, and for smaller `n`
an explicit list of primes is provided which covers the remaining cases.
As in the [Metamath implementation](carneiro2015arithmetic), we rely on some optimizations from
[Shigenori Tochiori](tochiori_bertrand). In particular we use the cleaner bound on the central
binomial coefficient given in `Nat.four_pow_lt_mul_centralBinom`.
## References
* [M. Aigner and G. M. Ziegler _Proofs from THE BOOK_][aigner1999proofs]
* [S. Tochiori, _Considering the Proof of βThere is a Prime between n and 2nβ_][tochiori_bertrand]
* [M. Carneiro, _Arithmetic in Metamath, Case Study: Bertrand's Postulate_][carneiro2015arithmetic]
## Tags
Bertrand, prime, binomial coefficients
-/
open scoped BigOperators
section Real
open Real
namespace Bertrand
/-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· ext x
simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply,
LinearMap.id_coe, id_eq, smul_eq_mul]
rw [β mul_lt_mul_left (two_pos)]
norm_num1
rfl
apply ConvexOn.smul
refine div_nonneg (log_nonneg (by norm_num1)) (by | norm_num1 | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x := by
let f : β β β := fun x => log x + sqrt (2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : β x, 0 < x β 0 < x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : β x, 0 < x β f x = log (x * (2 * x) ^ sqrt (2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' β) h5
have h7 := rpow_pos_of_pos h6 (sqrt (2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, β mul_div_right_comm, β mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) n_large
rw [β div_le_one (rpow_pos_of_pos four_pos x), β div_div_eq_mul_div, β rpow_sub four_pos, β
mul_div 2 x, mul_div_left_comm, β mul_one_sub, (by norm_num1 : (1 : β) - 2 / 3 = 1 / 3),
mul_one_div, β log_nonpos_iff (hf' x h5), β hf x h5]
-- porting note: the proof was rewritten, because it was too slow
have h : ConcaveOn β (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
apply ConcaveOn.add
exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : β) β’ LinearMap.id))) using 1
Β· ext x
simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply,
LinearMap.id_coe, id_eq, smul_eq_mul]
rw [β mul_lt_mul_left (two_pos)]
norm_num1
rfl
apply ConvexOn.smul
refine div_nonneg (log_nonneg (by norm_num1)) (by | Mathlib.NumberTheory.Bertrand.51_0.gJXoOT9Ce2wC0xc | /-- A reified version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 β€ x.
-/
theorem real_main_inequality {x : β} (n_large : (512 : β) β€ x) :
x * (2 * x) ^ sqrt (2 * x) * 4 ^ (2 * x / 3) β€ 4 ^ x | Mathlib_NumberTheory_Bertrand |